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 Editing library code for sketch (Read 4132 times)
Bob Jones
Full Member
***
Offline


Posts: 210
Location: Bellingham, WA
Joined: Dec 4th, 2015
Editing library code for sketch
Dec 5th, 2015 at 6:05am
Print Post  
Building a sketch that uses several libraries I developed the "old fashioned way" using the Arduino IDE. Now I want to do it all in VS/VM, but don't understand how to include the cpp and .h files in the project so I can edit them. They reside in the library folder where I can use them in other projects. 

Need to see a simple tutorial or example of how to configure this project to allow me to edit all the code in one solution. And what do I do with the keyword.txt files? Lips Sealed
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Editing library code for sketch
Reply #1 - Dec 5th, 2015 at 12:48pm
Print Post  
Hi, 

Out of interest, How did you open and test them when you used the arduino ide, what's the old fashioned way? that should also work with visual micro.

Visual micro follows the same rules as the arduino ide so keywords and lib structure will be the same.

There are a few ways you can achieve this. 

A simple way for minor edits is to click the project in the solution explorer and select "show arduino core and library sources". This will give shortcuts to all underlying sources which you can edit. If you add new sources to lib using this method you will need to click re-scan in the micro explore before they will be recognized.

The best I think is to right click the project and click "Add>New Arduino Library". This will create a library below the current sketch The reason for doing that is to demonstrate the "special" "_micro-api\libraries" folder where the library will be created. You can add your own existing libraries to the same location and #include them in the sketch using standard #include "mylib.h" syntax (no path). Sources in _micro-api\libraries are treated like real arduino libraries but can be easily edited and tested within a single project. When testing is complete move the library to documents\arduino\libraries. (There is also a "File>New>Project>Arduino library" option which creates a test sketch with a library). Local librares take priority over libs in ide or sketchbook folder.

Both the old arduino lib format and the new format are supported. The above example creates a new format library that has a library.properties file and an \src folder.

You can also have multiple projects in the solution and share source code between them by right click "add>existing item>cpp/ino/h"

Let me know how you get on. There has been a lot of work done recently to support these scenarios including better detection by the compiler cache of external (to the sketch) changes.
« Last Edit: Dec 5th, 2015 at 12:50pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Bob Jones
Full Member
***
Offline


Posts: 210
Location: Bellingham, WA
Joined: Dec 4th, 2015
Re: Editing library code for sketch
Reply #2 - Dec 6th, 2015 at 10:59pm
Print Post  
Thank you for your feedback and suggestions. I was able to build my libraries into the solution using your suggestion to create a new library and see where it put the files. I manually cut and pasted the content, so an "Import" function here would be useful.

I was not able to find the "Show arduino core and library sources" you mentioned. Couldn't find anything like it, but I sense that would be useful too.

I can get very close to compiling right now, but I am hitting one more wall: IntelliSense: cannot open source file "Servo.h".

I have read several posts that suggest there may be some configuration issues with the Arduino core library that I haven't dealt with. Any thoughts?

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Editing library code for sketch
Reply #3 - Dec 6th, 2015 at 11:14pm
Print Post  
Hi Bob, For intellisense on servo.h I suggest creating a new thread and posting or emaling the output after build. switch on "tools>options>visual micro>compiler>show build properties" so the build shows us your config. email to info[at]visualmicro.com
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint