Hi everyone. I'm kinda new to programming and especially the arduino. So far i used mostly VS which always had the advantage of me being able to see how all of my variables act while doing simple programms. Now i might get a bit over my head but i'd like to try making a simple programm, which i can use in (mostly) everything going forward with which i can see the variables change in real time.
Now my question is, is this doable? Is there a way to have the code for the display and the main code run side by side without one interferring with the other? I havent used a I2C display yet therfore I'm not sure how that exactly works, but if only want it to update every ~0.2s or something like that, do i need to slow down the whole programm?
I don't really need this to be 100% functional as i see this as more of a challange to learn more about programming, but knowing wether it is feasible at all will make it feel more rewarding.
Thanks in advance
You can use Serial.println and the serial monitor in the IDE.
Which board are you using? Some, like the ESP32, have more than 1 core so can do 2 things at once, but most do not so you cannot. You can make it look like more than one thing at a time.
LCD displays are slow. The serial port can be much faster (like 1,000,000 baud or more fast).
i own an arduino uno.
The serial port is for readout on pc right? does it have an option to show all variables at once or do i have to print them everytime?
Serial read seems to be the easier method, but the LCD does provide me with a reason to learn how to use I2C.
The link you provided seems very useful for what i'm trying to do.
Thanks for the reply
So why don't you continue to use VS?
how can VS see what state the inputs of the GPIO are
Yes. Either use the IDE serial monitor or a serial terminal like RealTerm or TerraTerm
You use the Serial.print() function to send whatever data out whenever you choose. If you want to watch a variable change every time through loop() you need to tell it to print every time through loop(). But you can't print more often than you can read so you may have to slow the program down. You can use the millis() timing to send data at predetermined intervals, too.
Some more (millis()) non-blocking timing tutorials:
Blink without delay().
Blink without delay detailed explanation
Beginner's guide to millis().
Several things at a time.
.
If you are going to use a 1602 or 2004 hd44780 controlled I2C enabled character LCD the hd44780 library will save you time and grief because the library will automatically determine the I2C address and the I2C backpack to LCD pin mapping. It is the best available library for those displays. The library is available via the IDE library manager.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.