5

If switch from Arduino IDE to Atmel studio or Visual Micro, how to use existing Arduino library?

Library serves important function of 'packaging' real and complex hardware (like NRF24L01 radio board) into functions of 'relatively standard format', like radio.init, radio.write, radio.read, radio.on, etc.

This allows user to easily use the hardware without reading the data sheet.

How can the same be achieved under Atmel studio?

sa_leinad
  • 3,218
  • 2
  • 23
  • 51
EEd
  • 904
  • 1
  • 14
  • 21

2 Answers2

3

At the end of the day, an Arduino library and the Arduino core are just files full of code.

There is nothing to stop you creating a project in Atmel studio (or wherever) and importing all those files into your project.

You will need all the core files (hardware/arduino/core/arduino/*) plus all the files for the libraries you want to use.

Majenko
  • 105,851
  • 5
  • 82
  • 139
2

Visual Micro supports all Arduino libraries in the same way that the Arduino IDE supports these libraries.

When using Visual Micro in Atmel Studio your sketch code remains identical to the Arduino IDE. You can switch between the two IDEs and see the same compiler results.

If you can not see your user libraries on the "Atmel Studio>Projects>Add/Import Sketch Library" menu then this means you have configured the SketchBook folder path incorrectly.

Arduino and Visual Micro use the SketchBook folder to find user libraries in a sub folder called 'Libraries'.

I recommend leaving the sketchbook folder empty because Visual Micro will then auto discover the SketchBook folder that the Arduino IDE uses and remove the possibility of confusion.

When the sketchbook folder is empty and has not been set in the Arduino IDE the default will be myDocuments\Arduino, therefore your user libraries will be expected to exist in myDocuments\Arduino\Libraries.

@John, in response to your question below. It's a big topic and maybe best answered in our forum.

A few examples are:

  • Ability to re-define arduino core to use tools such as cygwin, we see the Arducopter example as a good one for this. They produce a window SITL program.

  • Obviously we can all use the flexible Arduino 1.5 config structure to define our own hardware and build process but we also support the Teensy customization system which allows windows apps/tools to manage the build process and tool chains. Visual Micro supports both of these customizations combined in the same hardware def but also a number of other build properties.

  • There is also the ability, in Visual Micro, to add compiler #defines for project or configuration and the ability to add programmers that use, for example, the atmel toolchain (if using atmel studio).

  • Libraries can be referenced with a folder name (unlike arduino) which allows different projects to use similar libraries but of different versions. (Library paths are declared for the lib folder roots as well as individual libraries).

  • If you consider the various different build properties build properties of Arduino, Teensy, Energia, ChipKIT and Intel then add a few on top this describes what you can do in any project regardless of hardware IDE.

Visual Micro
  • 1,027
  • 6
  • 13