Getting Started wit...
 
Notifications
Clear all

Getting Started with PlatformIO

68 Posts
30 Users
28 Likes
7,345 Views
PeterH
(@peterh)
New Member
Joined: 2 years ago
Posts: 1
 

I had a problem with uploading the code to my Seeeduino xiao. I had to try several times before it succeeded, and the monitor complained about the device was busy.

I have installed PlatformIO on a Centos linux server.

It turned out to be at problem with udev.
Centari mentioned earlier that he had to install 99-platformio-udev-rules.
But the latest version does not contain settings for Seeduino xiao.

In order to fix the problem I made a new rule in /etc/udev/rules.d

80-local-rules:

ATTRS{product}=="Seeeduino XIAO", ENV{ID_MM_PORT_IGNORE}="1"

 

And run the program: udevadm control –reload

And this fixed the problem.

 

There is an excellent explanation of udev here:

https://opensource.com/article/18/11/udev

 

Hope this helps if someone have the same problem.


   
Centari reacted
ReplyQuote
KUTGV
(@kutgv)
Active Member
Joined: 3 years ago
Posts: 10
 

Best intro video on PlatformIO. You fellow collegue with the swiss accent has posted how you can do inline debugging with platformio. I already bought the intermittent device but have not yet got the chance (read: time) to check out his statements (which are normally all correct).

Oh yeah, good idea to have a forum post linked to the video.

 

Mario


   
Centari and YurkshireLad reacted
ReplyQuote
TheOutlander
(@theoutlander)
Estimable Member
Joined: 2 years ago
Posts: 77
 

Both of these resources got me started on PlatformIO and Visual Studio Code (I'm not a developer by trade). Took a bit of tweaking, including replacing a defective USB cable, but got the LED to blink. Vacation next week will be spent in the homelab!

"Hardware eventually fails. Software eventually works." - Michael Hartung


   
Centari reacted
ReplyQuote
YurkshireLad
(@yurkshirelad)
Honorable Member
Joined: 2 years ago
Posts: 472
 

Ooh another video to watch! Thanks for this.


   
ReplyQuote
Ezward
(@ezward)
Eminent Member
Joined: 3 years ago
Posts: 16
 

I use PlatformIO for my differential drive robot project, https://github.com/Ezward/Esp32CameraRover2   For this project is has two advantages over the Arduino IDE 1) It is much easier to structure a large project with multiple files 2) It handles multiple programming languages easily.  It is a joy to use with JavaScript; since my project is based on the ESP32Cam it includes a lot of html/css/javascript.  It even understands and can preview markdown for documentation.


   
Centari reacted
ReplyQuote
MadMisha
(@madmisha)
Reputable Member
Joined: 3 years ago
Posts: 348
 

I first tried PlatformIO after seeing the video from our favorite guy with a Swedish accent. I had some issues with it at first and I am happy to see that there have been some great updates to it. But I gave up on it after I found the Arduino plugin. It requires you to have the Arduino IDE installed but it acts exactly like the Arduino IDE. You do not need to include the board library.

 

For beginners, I would actually recommend this instead. You can write your code exactly like you would in the Arduino IDE but with all the benefits of VS Code. It is also easier selecting your board and programmer. I also find that the serial monitor is easier to use. It just has a dropdown to select your baud rate.

 

I do really like the way PlatformIO handles versions of libraries. I might give it another try. But the easier plugin is always an option. Just getting into an editor like VS Code that allows you to code various languages in the same familiar environment is really a great thing. I use it for just about everything but Kotlin now.


   
Centari reacted
ReplyQuote
noweare
(@noweare)
Estimable Member
Joined: 3 years ago
Posts: 115
 

@madmisha I did the same thing at least a couple of years ago. I though Platformio was slow and felt clunky. The I used the VSCode plugin for arduino.

It seems PLatformio is much better now. I guess the second time around with help from DroneBot workshop video it is much better.

 


   
Centari reacted
ReplyQuote
noweare
(@noweare)
Estimable Member
Joined: 3 years ago
Posts: 115
 

@ezward That project looks pretty cool. One of these days ....


   
ReplyQuote
PRRH
 PRRH
(@prrh)
New Member
Joined: 2 years ago
Posts: 4
 

Just decided to convert a program I wrote with Arduino onto PlatformIO . Basically its max min Temp & Humidity on Arduino Nano using DH22 displaying on a 20,4 LCD. The problem was the Liquid_Crystal_i2c library. I found the version's LiquidCrystal_i2c were not compatible with this code

#

#include <LiquidCrystal_I2C.h>

// Define LCD pinout

const int en = 2, rw = 1, rs = 0, d4 = 4, d5 = 5, d6 = 6, d7 = 7, bl = 3;

// Define I2C Address - change if reqiuired

const int i2c_addr = 0x27;

LiquidCrystal_I2C lcd(i2c_addr, en, rw, rs, d4, d5, d6, d7, bl, POSITIVE);

The Library you need to add for the above code is just LiquidCrystal

Hope the might save sombody some time as I have spent some time going back through old ZIP file libraries!!!

 

This post was modified 2 years ago by PRRH

   
Sean451 reacted
ReplyQuote
TheOutlander
(@theoutlander)
Estimable Member
Joined: 2 years ago
Posts: 77
 

@prrh

Thanks. I have code for temp & humidity on an Uno with 16x2 LCD using DHT11 sensor. I used the Arduino IDE ( and it works, hurray for me 🙂 ) so I figured it was a good code to move to PlatformIO. I'll double-check the libraries!

"Hardware eventually fails. Software eventually works." - Michael Hartung


   
ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 4 years ago
Posts: 1506
 

@prrh

Posted by: @prrh

Just decided to convert a program I wrote with Arduino onto PlatformIO . Basically its max min Temp & Humidity on Arduino Nano using DH22 displaying on a 20,4 LCD. The problem was the Liquid_Crystal_i2c library. I found the version's LiquidCrystal_i2c were not compatible with this code

#

#include <LiquidCrystal_I2C.h>

// Define LCD pinout

const int en = 2, rw = 1, rs = 0, d4 = 4, d5 = 5, d6 = 6, d7 = 7, bl = 3;

// Define I2C Address - change if reqiuired

const int i2c_addr = 0x27;

LiquidCrystal_I2C lcd(i2c_addr, en, rw, rs, d4, d5, d6, d7, bl, POSITIVE);

The Library you need to add for the above code is just LiquidCrystal

From what you've shown here, "LiquidCrystal_I2C.h" looks compatible from all examples I have seen and used.  Did you remember to include the <Wire.h> library with <LiquidCrystal_I2C.h> ?

How was min, max, temp and humidity affected?

What were the errors, if any?

Cheers.


   
PRRH reacted
ReplyQuote
PRRH
 PRRH
(@prrh)
New Member
Joined: 2 years ago
Posts: 4
 

@frogandtoad

The problem was not the code it was which Library to add to Visual Studio code to get the code to work.

The temp/humidity was not effected as I transmit the results to another Arduino nano using (NRF24) the arduino.ide 

which displayed the results on a LCD.

The LCD on the client was not displaying anything until I changed the library. 

In answer to wire.h I had included OneWire.h

One of the LiquidCrystal_i2c libraries which I added allowed the program to compile but not display the data on a LCD.

(Hence the results transmitted to another Nano showed the program seemed to be working but not displaying on the LCD on the local machine)

 

Thanks for your input.

Cheers 👍 

 

 

 

This post was modified 2 years ago by PRRH

   
ReplyQuote
jfabernathy
(@jfabernathy)
Estimable Member
Joined: 2 years ago
Posts: 148
 
Posted by: @kutgv

Best intro video on PlatformIO. You fellow collegue with the swiss accent has posted how you can do inline debugging with platformio. I already bought the intermittent device but have not yet got the chance (read: time) to check out his statements (which are normally all correct).

Oh yeah, good idea to have a forum post linked to the video.

 

Mario

When I got back into all this micro-controller stuff I wondered if an old tool I had laying around might be useful. It's called "DediProg SF 100". I sort of remember hooking it into development  boards back when every chip had a JTAG interface and they were all in a chain on the motherboard. You could re-flash chips with it.

So my question is could that be used with PlatformIO to do the debugging that the video talks about? 

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


   
ReplyQuote
KDLaun
(@kdlaun)
Active Member
Joined: 2 years ago
Posts: 3
 

Thanks so much for making this video. It helped me tremendously with actually being able to use PlatformIO. I had installed VSCode many months ago, but became so frustrated with trying to understand the inner workings that I just gave up for a while. I've now dedicated myself to at least try every project in PIO so that I can get more familiar.

One thing I haven't really been able to fully understand is the file hierarchy and conventions used. It was a little challenging at first to find where my projects were actually saved and then the method to save them to a place of my choosing. My preferred place for me would be in something like "Documents\PlatformIO\" as that's a location that gets backed up regularly. This might be a topic for Part 2.

On a similar note, I've found it's not immediately apparent how to rename your projects if you change your mind later on. Possibly you can rename it in the project folder and re-open it in PIO?

Part 1 really helped me understand how libraries were handled, but there are a couple instances I still have questions on. Say you want to associate a different library with the project, is it as simple as removing the lib_deps = entry in the .ini file, or is some other action required? I found a YouTube video that addresses the use of outside libraries, I'll link it below. It also covers adding "build_flag" tags to the .ini file should your library require it.

Finally, the creation and management of "Workspaces" is a still a total mystery to me. I have one workspace that I have saved (the file is just a list of paths), but would like to create others for better organization. The method for doing that isn't immediate obvious (to my simple brain at least). Another topic for Part 2?

 

Easy Migration from Arduino IDE to Platform IO Part 1 of 2

Easy Migration from Arduino IDE to Platform IO Part 2 of 2

 


   
ReplyQuote
KIMOSUBBY
(@kimosubby)
Active Member
Joined: 2 years ago
Posts: 14
 

Hi Bill, great video as always and I've now got PlatformIO up and runnng.

Q. During the video you demostrated a sketch from the Arduino IDE that complied fine, with the extended blink routine. Then you put the same sketch code into PlatformIO and ran the compiler which popped up errors. These were the void statements positioned in the code after the loop, as is normal for Arduino IDE. The statements were then moved up to before the run loop and the code compiled fine and was then uploaded and run ok.

Does this code layout work when this modified structure, void before loop statements work if used in the Arduino IDE. That is, will the code complied and used via PlatformIO  work if loaded unchanged back into the Arduino IDE or will the Arduino IDE flag up a compiling error?

Aye, Kim


   
ReplyQuote
Page 2 / 5