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?

2
  • Sorry for hijacking your question. Arduino itself is actually also a library. E.g. pinMode, digitalWrite and delay aren't standard functions. Just like your sketches, a lot of libraries depend on these functions. How would one get these to work as well in Atmel studio?
    – Gerben
    Commented Sep 26, 2014 at 19:08
  • The thing that I just found is that you need to have Visual Studio, not Atmel Studio. For some reason you cant, AFAIK, add libraries with AS.
    – bwoogie
    Commented Sep 15, 2016 at 2:36

2 Answers 2

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.

2
  • Thanks for the answer which cover (a) as below taken from official web. Can you please state a bit more specific on (b). From web, (a) New Arduino users are guided to work within the normal Arduino framework, in a similar manner to the Arduino IDE. (b) Advanced Arduino users have a range of options that allow the simple (but restricting) Arduino rules to be broken.
    – EEd
    Commented Sep 29, 2014 at 13:32
  • @John Some answers above in the post Commented Sep 29, 2014 at 18:45
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.