Getting Started wit...
 
Notifications
Clear all

Getting Started with PlatformIO

74 Posts
32 Users
28 Likes
10.4 K Views
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1018
 

@kimosubby

I'm working from memory at the moment, which is sometimes quite flaky, but I think I remember several times putting my functions at the beginning of the code when using the Arduino IDE instead at the end and it worked fine.

SteveG


   
ReplyQuote
(@jfabernathy)
Member
Joined: 3 years ago
Posts: 141
 
Posted by: @jfabernathy

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? 

So I have had no positive answers to my question on the DediPorg SF 100.  Although you can buy one for $300 on the web, I doubt I could sell mine for that.

I found one of the ESP32-Prog JTAG debugger board for $12 from Digikey and with shipping it only mounted to $20 so I picked one up. 

If you decide to go down this path, let me say, in the end, it works great; but it took me a day to figure it all out. One video showed it connected wrong. Bottom line is you need a USB cable between your ESP32 MCU and your development PC and also a USB cable between the ESP-Prog and the PC. There are JTAG jumpers needed between pins on the ESP32 MCU and the ESP32-Prog. BUT DON'T connect the 5V as shown in a popular video.

If you are using Linux there are always libraries not loaded by default that you find out as you try to run it.

So the ESP-Prog works great, with the only problem being occasionally you have to unplug the ESP-Prog USB cable while you upload your sketch, then reconnect. It's very nice for stepping through code, watching variables, and setting conditional breakpoints. Very nice tool for $12

 

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


   
noweare and LarryTubbs reacted
ReplyQuote
Centari
(@centari)
Member
Joined: 4 years ago
Posts: 44
 

@prrh, I was pointed to the LiquidCrystal_PCF8574 library and it worked with no trouble. The project is currently showing temp and humidity while lighting a light switch for my sister to find when she comes in and it's dark. I'll extend it in a couple months to include outside temp and humidity as it's a 4 line display.

If I recall correctly, it was Mr. DroneBot himself that got me squared away on the library. (memory's not great and I've slept since then.)    😉 


   
ReplyQuote
(@pcolls)
Member
Joined: 3 years ago
Posts: 3
 

 

I am in the process of designing and building my own Bench Power Supply.

I have purchased a number of ESP-32 Wrover e Modules and 3 X 5 Touch Screens as the human interface for the Power supply. I have it all working using the Arduino IDE but would like to use Visual Source Code, C++ and Platformio for the debugging and layout features.

Having recently watched your video “Getting started with Platformio”. I would like to submit a question to the Forum as I think it may relate to your next video.

I have the VSC IDE working and have loaded and built a number of small programmes. My issue is: When building more complex systems e.g.  the 480 X 320 touch screen number pad using the Library TFT-eSPI v2.3.59, When compiling the  480 X 320 touch screen number pad program I get number of cryptic syntax errors relating to: Identifier, Declaration and Unqualified-ID.

I have included all the TFT-eSPI library controlling variables in the Platformio.ini file.

I understand that the Arduino IDE Modules can be defined as they are used and the VSC IDE requires more stringent rules, but I can’t find any document or YouTube (apart from the above that gets close) that provides detailed examples of this issue.

 

Thank you


   
ReplyQuote
noweare
(@noweare)
Member
Joined: 4 years ago
Posts: 110
 

Your best bet is to post output of your compile, the error msgs.


   
frogandtoad and Centari reacted
ReplyQuote
(@pcolls)
Member
Joined: 3 years ago
Posts: 3
 

@noweare

Hope this is what you are looking for...

X declaration does not declare anything [-fpermissive] 194, 1

X expected unqualified-id before ‘{‘ token [195, 1]

X expected a declaration C/C++ (169) [195, 1]

X expected a declaration C/C++ (169) [216, 1]

X expected a declaration C/C++ (169) [237, 7]

X expected a declaration C/C++ (169) [283, 30]

 

Many Thanks

Peter

 


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@pcolls

Posted by: @pcolls

@noweare

Hope this is what you are looking for...

X declaration does not declare anything [-fpermissive] 194, 1

X expected unqualified-id before ‘{‘ token [195, 1]

X expected a declaration C/C++ (169) [195, 1]

X expected a declaration C/C++ (169) [216, 1]

X expected a declaration C/C++ (169) [237, 7]

X expected a declaration C/C++ (169) [283, 30]

 

Many Thanks

Peter

 

It would be good to see the code for where and how X is declared or defined.

If I had to guess, you may be missing a simple semi-colon, or it could be that your declaration or definition of X may not be in visible scope, as you may be calling it before the relevant part of the code knows about it.

As the source code is read sequentially from top to bottom, this is something to be aware of, and just the way the C and C++ languages compilers parse the source code, and VSCode adheres to those rules whereas the Arduino IDE does not, and uses some pre-parsing trickery to help newbies get going without worrying about such details.

Cheers.


   
ReplyQuote
(@pcolls)
Member
Joined: 3 years ago
Posts: 3
 

@frogandtoad

The "x" is not a variable its the start of the error message I had to type the list of errors as the copy from VSC did not paste well in the forum. The "X" is displayed in a Cicule within VSC. It is important to note that the code is copied without change from the TFT-eSPI v2.3.59 library within the Arduino IDE system, using the "touch screen number pad program" within the 480X320 examples.

I have checked for missing semi-colons and all seems to be correct. My primary issue is that the error messages do not seem to be describing the correct issue because when I inspect the referenced line of code there does not seem to be an error.

I accept your point "As the source code is read sequentially from top to bottom" and I think this is where the issue is but as a newbie with C++ I don't have the experience to clearly identify the problem. I was hoping your next video would give me a clue.  

The "touch screen number pad program" is 300 lines long, a bit big to drop into the forum; is there any way I can send you the file?

Many Thanks - Peter


   
ReplyQuote
(@yurkshirelad)
Member
Joined: 3 years ago
Posts: 493
 

You can upload it to these forums (Attach Files) when you create a reply to this topic.


   
ReplyQuote
noweare
(@noweare)
Member
Joined: 4 years ago
Posts: 110
 

If you are #defining in your program use  #define xxxx  0      or something other than 0. Dont leave it blank.


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 
Posted by: @pcolls

@frogandtoad

The "x" is not a variable its the start of the error message I had to type the list of errors as the copy from VSC did not paste well in the forum. The "X" is displayed in a Cicule within VSC. It is important to note that the code is copied without change from the TFT-eSPI v2.3.59 library within the Arduino IDE system, using the "touch screen number pad program" within the 480X320 examples.

I have checked for missing semi-colons and all seems to be correct. My primary issue is that the error messages do not seem to be describing the correct issue because when I inspect the referenced line of code there does not seem to be an error.

I accept your point "As the source code is read sequentially from top to bottom" and I think this is where the issue is but as a newbie with C++ I don't have the experience to clearly identify the problem. I was hoping your next video would give me a clue.  

The "touch screen number pad program" is 300 lines long, a bit big to drop into the forum; is there any way I can send you the file?

Many Thanks - Peter

Without seeing the code or being able to compile it, it's difficult to say exactly what the problem is, other than the code is non-conforming to the standard being used by the compiler.

For example, if the "-fpermissive" switch is present, it tells the compiler to produce warnings instead of errors, and the Arduino implementation has this set, at least it is on my Arduino IDE by default.  What that error is saying, is that you can apply the "-fpermissive" switch to your compiler to ignore such an error and produce a warning instead - So it's hard to tell what part of the code is non conforming C++ code.

Perhaps try to install one of the good C++ extensions that offer good linting etc... and hovering over the squiggly might just tell you the exact error.

Cheers.


   
ReplyQuote
(@euticus)
Member
Joined: 3 years ago
Posts: 3
 

I am currently experimenting with my new XIAO.  Switching from Arduino IDE to PlatformIO definitely improved the experience.  In my tests,  it appears that "Serial" and "SerialUSB" refer to the same port; at least in my case data was always output through the onboard USB connector.  I tried using Serail 1 (my aim was to use the UART) - but I never got any output on those pins.  Has anyone else found a solution?


   
ReplyQuote
JimiB
(@jimib)
Member
Joined: 3 years ago
Posts: 6
 

Hello all! 

I have some real problems installing and getting all this to work! I use Windows 7 I know shame on me 😐 , but when I have something that works I tend not to change it. The Python 3.9.2 link wouldn't install because it requires Windows 8.1 or higher, I haven't used VS Code before I currently use Visual Studio 19 so they never heard of PlatformIO or its IDE. I tried Installing VS Code that worked and then Platformio and an OLDER version of python 3.7.4 that didn't go well either. Apparently you need an IDE chain of some kind so there you have it. 

I'm trying a manual install of all the Cores and  Extensions maybe I can get it to work here. 

Personal quote "Anything that requires Microsoft Anything is a pain in the BOT!" 

I'll let you know how it turns out!

Thanks J

 

James Bearss


   
ReplyQuote
stevenbennett
(@stevenbennett)
Member
Joined: 3 years ago
Posts: 6
 

@jimib Hi James, I've been tinkering with PlatformIO on Win 10 but have always had issues every time VSCode or the PlatformIO plugin updates, I suspect this is a problem with the Windows versions of the IDE as since I have made my PC dual boot with Linux Mint (I don't like the Ubuntu GUI) I find the Linux versions, as described in Bill's setup video, are very stable and I have not had a single problem.  It's your PC but if it was mine I would save my data and replace Win 7 with Linux Mint.

Steve


   
ReplyQuote
(@bobcroft)
Mr
Joined: 3 years ago
Posts: 1
 

@centari I glad you mentioned function prototypes because that is the correct programming method.  The other thing I do if I have a lot of functions is to put the prototypes in a separate header file, say, prototypes.h and include that with the other includes.  I think it keeps the code tidier.


   
Centari reacted
ReplyQuote
Page 3 / 5