Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Difference between New Project->Arduino Sketch Vs New Sketch Project (Read 5241 times)
sdc88
Newbies
*
Offline


Posts: 2
Joined: Feb 7th, 2014
Difference between New Project->Arduino Sketch Vs New Sketch Project
Feb 7th, 2014 at 10:13pm
Print Post  
Hi,

I'm using the latest Atmel Studio and latest VM Arduino.  Sorry if this is a newbie question.

When going to the File new--new project - arduino sketch, there is no option to import any of the Arduino libraries as per the wiki link; There is no add library option, and the add sketch is greyed out.  Also when debugging, the main.cpp etc will not be uploaded to the board.

However when you add a sketch to a solution with File-new-new sketch project, the add library and sketch items are available and the sketch will upload.

My question is there a way of importing arduino libraries for the first method? Are we not supposed to be using the File-new-new arduino project?

Thanks for your time.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Difference between New Project->Arduino Sketch Vs New Sketch Project
Reply #1 - Feb 7th, 2014 at 10:40pm
Print Post  
Hi,

No not a newbie question at all. It's also not easy to answer so I'll dump some info and feel free to clarify anything that doesn't make sense.

The situation might shortly improve because Atmel have asked if we can add a "pro" mode that is a bit less Arduino and a bit more Atmel Smiley Anyway for now ...

When Visual Micro detects an Arduino project then the Arduino rules are applied to the compile. This means Atmel Studio is completely overridden. The result is a 100% compatible Arduino compilation and ensures the same code can be compiled in the Arduino Ide. Bear in mind that an Arduino project does not include a project file it is simply a folder and a .ino with the same name.

Visual Micro will become active and provide Arduino functionality if you create a new Gcc C++ Application project and select your mcu from the std wizard. The mcu you select should ideally be a supported Arduino processor such as sam or mega2560, 328p etc. Then rename the [projectname].cpp to [projectname].ino. In which case you might as well delete all of the other files and sub folders that Atmel automatically creates for the new project because only the source files in the project folder will be considered in an Arduino compile. If your project includes a main.cpp the Arduino compile will break because Arduino has it's own which is automatically included during an Arduino compile.

This page contains a zip file that you can place on your machine giving you the ability to have a new Arduino 
project entry in the File>New>Project dialog. It makes life a bit simpler but also shows you how to create your own "new sketch" templates. Might of interest in the future.
You would then remove the code from inside the .ino and replace with setup() and loop() methods as per a normal Arduino project.

As far as Arduino libraries are concerned they are in source code format when normally Atmel Studio expects achieves (.a and .h). In an arduino sketch you will also notice that #include for libraries are never qualified with a path. Just, for example, #import "Servo.h". During an Arduino compatible compile Visual Micro does what the Arduino Ide does. It searches a number of predetermined Arduino locations for each included library based upon the .h name and then ensures the -l compiler include paths are correct. This process is entirely different from how a normal compiler in products such as Atmel Studio works.

So if this doesn't help please give more clarity on what you would like to achieve. Is it simply adding an Arduino library to a standard Atmel Studio compile? Don't think that will work unless you copy the Arduino core and libraries to below your project. Then include them yourself and don't use .ino sources files. Just cpp

  
Back to top
IP Logged
 
sdc88
Newbies
*
Offline


Posts: 2
Joined: Feb 7th, 2014
Re: Difference between New Project->Arduino Sketch Vs New Sketch Project
Reply #2 - Feb 12th, 2014 at 2:05am
Print Post  
Tim@Visual Micro wrote on Feb 7th, 2014 at 10:40pm:
Is it simply adding an Arduino library to a standard Atmel Studio compile? Don't think that will work unless you copy the Arduino core and libraries to below your project. Then include them yourself and don't use .ino sources files. Just cpp


This is what I was trying to do. So instead I started a sketch project, but now adding them via the add/import sketch library gives me a compile error. I am so confused. 

"Compiling 'test3' for 'Digistump DigiX (standard)'
WiFiUdp.h:In file included from
test3.ino:from
Udp.h:41: error: expected identifier before numeric constant
Udp.h:41: error: expected unqualified-id before numeric constant
XivelyClient.cpp:No such file or directory
:compilation terminated.
spi_drv.cpp:No such file or directory
:compilation terminated.
Error compiling"
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Difference between New Project->Arduino Sketch Vs New Sketch Project
Reply #3 - Feb 12th, 2014 at 1:27pm
Print Post  
Hi there,


The first thing that would help is if you can upgrade to the latest release of Visual Micro. It has better error messages which might be useful here.

I also suggest you zip your sketch and email to info [at] visualmicro.com, please include any sub folders in the zip and a link to this post in your email.

Please also state where you installed the libraries from (urls) and additional hardware for your board (url).We can then give better help.

The error looks as if a required library has not been installed, however there have been a huge number of library changes in the various Arduino Ide version during the last year so it is best to keep your Visual Micro install up to date if you encounter difficulties.

Thanks
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint