For the PlatformIO User  

  RSS

codecage
(@codecage)
Member Moderator
Joined: 6 months ago
Posts: 303
2019-08-02 8:01 pm  

Are there any in our group?

As you expand your coding capabilities, or maybe even before you start, you might want to look into PlatformIO.  It allows you to 'seamlessly' (yeah right; not sure of how many seams might get busted) move between Ardunio's, ESP8266, ESP32 and many others (see their website), and still write code, compile, load, and execute your programs.  It integrates with Atom or Visual Studio Code (I know, MS!) but provides for a bigger set of tools to help you along with your project.

I've just started digging into it myself and while it looks like there maybe a steep learning curve ahead, it does look like a good direction to be headed in.  I know it is supported both on a Windows and a Linux system (would guess VS Code won't run on Linux, but Atom will).  Don't know about Apple.

I've just started learning about PlatformIO, so I won't be of a whole lot help for awhile yet, but thought I'd start this thread so we'd have a place to share our experiences with PlatformIO as we romp around the WorkShop.

SteveG


Quote
triform
(@triform)
Estimable Member
Joined: 5 months ago
Posts: 194
2019-08-02 8:08 pm  

I use it, but still mostly from the command line, though I do have the Atom extension installed.  It did work on Apple last time I checked, but my MacBook has Linux on it now. I also use it for plain Atmega coding as well, but not pic as it's pic selection is still limited.

Scott

 


ReplyQuote
Robo Pi
(@robo-pi)
Noble Member
Joined: 6 months ago
Posts: 1048
2019-08-02 8:37 pm  

I started looking into PlatformIO but then discovered that Visual Studio can also be used for writing Arduino Code.  Since I already use Visual Studio for writing C# Windows Forms programs I figured I may as well stick with it for the Arduino code as well.  I actually installed the Arduino code module in Visual Studio but haven't even used it yet.   They main feature I was looking for is the "Intellisense" that keeps track of all your variable names, etc.

I was doing this with my robot arm control program because the program was getting quite involved.  This was in-part because I was also using a micro SD card reader along with a PCA9685 servo controller board.

However, what I ended up doing was creating my own Arduino Libraries to break up my Arduino code into smaller files.  I would post a screen shot of the IDE with the library tabs, but I still can't post pictures yet.

I was going to write an article thread on how to create your own Arduino Libraries to make coding much simpler.   But even that took a back seat to other things.  The topic probably needs a video to really be effective.

As an example, the full program was about 250 lines of code.  And within that were routines to read the SD card, and routines to deal with 4 servos on the PCA9685 board, plus some code written for telling the arm what to do.

At this point I was done with the SD card reader code and the PCA9685 code and wanted to just focus on routines for controlling the arm movements.   So this is when I divided the program up into separate libraries.

The arm controller code remained in the original code tab.

But I then  moved all the SD Card  reader code to a new library I entitled SD_Card.h and SD_Card.cpp.

I moved all the PCA9685 code to a new library I entitled PCA9685.h and PCA9685.cpp.

This reduced my main program to just 85 lines of code.   It makes it much easier to work with then.  And when I want to use the code I wrote for the SD card reader or the PCA9685 board I just call the routines that I had written in those libraries.  Using this method you can write programs that have thousands of lines of code but at any one time you only need to deal with a file that only has about 100 lines of code.

At this point I found that it's easy enough to work with the Arduino IDE that I lost incentive to move over to Visual Studio.  So I haven't even tried it over there yet.  I probably should though.   But making my own libraries in the Arduino IDE made things a lot simpler.  So that worked for me in this situation.

DroneBot Workshop Robotics Engineer
James


ReplyQuote
Pugwash
(@pugwash)
Honorable Member
Joined: 6 months ago
Posts: 569
2019-08-02 8:39 pm  

VS Code works fine on MacOS, I use it all the time. Guess I'll have to look into PlatformIO then.

SteveC - Oh Lord, please don't let me be misunderstood! (Eric Burdon and the Animals)


ReplyQuote
codecage
(@codecage)
Member Moderator
Joined: 6 months ago
Posts: 303
2019-08-02 10:28 pm  

@pugwash & @robopi

PlatformIO is sort of a wrapper around/inside VS Code and they work together.  Your editing is done with VS Code but PlatformIO adds the big bells and whistles.  But again as I'm just learning I could be talking out of school.

 

SteveG


ReplyQuote
byron
(@byron)
Trusted Member
Joined: 6 months ago
Posts: 92
2019-08-02 11:13 pm  

I downloaded PlatformIO for a quick look a month back, but I could not see a compelling case to put time and effort into it so sent it to the trash bin.   I had also tried out the Wing IDE for python development and decided on that for python, and to stick with the  native Arduino IDE for now.  Several of my arduion/esp8266/esp32 boards also have the option of micro python or circuit python as a platform and I'm thinking to get up to speed on that option and perhaps switching to board that have that option loaded.

However I see that PlatformIO has some good comments about it, so I will have my beady eye on whether you find much advantage on doing your developments on this platform.  Do please give an assessment once you have had a chance to get up to speed on it.


ReplyQuote
Spyder
(@spyder)
Honorable Member
Joined: 6 months ago
Posts: 541
2019-08-03 3:56 am  

I started the install process for the esp32cam when nothing else worked

Haven't actually used it yet


ReplyQuote
Pugwash
(@pugwash)
Honorable Member
Joined: 6 months ago
Posts: 569
2019-08-03 10:27 am  

Perhaps it already exists but I am unaware of it!

Something that could be really useful would be virtual microcontrollers to test code before uploading it. Testing everything on attached Arduinos & Co. can be really tiresome.

With a monitor of virtual i/o pins, with ability to set virtual digital pins High or Low, create voltages on the virtual analog pins, create interrupt requests or even simulate I2C traffic.

If this already exists, please enlighten me!

SteveC - Oh Lord, please don't let me be misunderstood! (Eric Burdon and the Animals)


ReplyQuote
Pugwash
(@pugwash)
Honorable Member
Joined: 6 months ago
Posts: 569
2019-08-03 12:29 pm  

Rhetorical answer!

Me: Why don't you just Google "Arduino simulators" before posting such a dumbass question!

Me: Why isn't there an emoji with a dunces cap? 

 

SteveC - Oh Lord, please don't let me be misunderstood! (Eric Burdon and the Animals)


ReplyQuote
Pugwash
(@pugwash)
Honorable Member
Joined: 6 months ago
Posts: 569
2019-08-10 9:43 am  

I stumbled across this from "the guy with the Swiss accent", I believe it is a good quick description for anyone thinking about giving PlatformIO a try and too lazy (like myself), to research manually in the WWW.

SteveC - Oh Lord, please don't let me be misunderstood! (Eric Burdon and the Animals)


ReplyQuote

Please Login or Register