The Arduino microcontroller has a nearly limitless array of innovative applications for everything from robotics and lighting, to games and gardening! It's a fun way to automate everything, enabling you to control simple devices or manage complex Halloween displays.
Here are some of the best do-it-yourself Arduino technology projects to educate and inspire you to make great things!
So I have been trying to get project 14 working on the Arduino. However, the logo just changes colors wildly, and takes no input from the Arduino - when I take out the white knob, it does nothing for the program.
The code is correct- I typed it twice; I used the processing code both from the website with Processing 3.2.3 and from my more outdated Aruduino book with Processing 1.5.1. Each time, it did the same thing - values appeared in the console on Processing, but the values were random, and not connected to the Arduino. The color change on the logo matched those values.
If it makes a difference, I loaded the image from my desktop (I did save it in sketches in Processing) and not the web, since the computer I was using was not connected to the internet.
Also, I did used this tutorial: How to "get type string[] of an argument to match the vararg parameter type"? - Programming Questions - Arduino Forum
to get rid of an error on Processing 3.2.3. Still, it did not work!
Sorry - I assumed all the Arduino boards had the same workbook. I have the Arduino Uno.
Project 14 is "Tweak the Arudino Logo." The goal of the project is to turn the potentiometer (connected to A0)on the breadboard and change the color on the sketch of the Arduino logo on Processing. I don't know if you had used that- it's needed for this project in my workbook, but I don't know about other Arduini.
Sounds like you have not wired the pot up to the Arduino correctly and the analogue input is not connected to anything. This condition is said to be a "floating input" and will produce random numbers due to pick up of interference signals.
I just checked my wiring again; it is the same as in the book, except that the pot is straddling the middle of the breadboard (with the A0 wire then on the other side with the single-pin side of the pot). This seemed to make no difference in my other projects. Still I tried putting all the wires and the pot on one side; it made no difference. Other than that there is no difference between my breadboard and the example in the book.
Show us a photo of that pot wiring, it sounds very wrong. Your problem is that pot, write a small sketch to output the pot reading to the serial port and view it in the serial plotter. You will find out if it works or not.
This action is known as fault finding.
So I tried this, and when I connected A0 to GND, the values in my fault finding program (which I wrote above) fluctuated around 918. When I tried this by wiring A0 to 5V, the values fluctuated around 230 - though first, when I opened the serial monitor, it went to 359 and then down to 230. I kept A0 connected to 5V, and tried using my fault-finding program in conjunction with the Processing sketch. The values for the image fluctuated around 50, in time with the delay of (3000) which I set to test if it was communicating, which seems at least more consistent than with the pot, even though we were supposed to use Serial.write, and the fault-finding program uses Serial.print. I thought maybe that means that Serial.print can work with processing (perhaps I interpreted the results of the previous test incorrectly, though), so I used my fault finding program, while it was connected to the pot, with the processing sketch. But the colors changed wildly again.
It looks like you are doing everything correctly however the results of those two tests are not consistent. The first where you have the pot is correct, however the second where you wire A0 to 5V and ground is not what you should see. You should see a solid value of zero when connected to ground and a solid constant value of 1023 when it is connected to 5V.
@Frdric_Plante
Can you address the problem the OP is facing and not try and boost your ego. Try and be helpful and suggest something he can do to get his circuit working. I know it goes against the grain for you but try please.
However, in the meantime, I had to rebuild my computer, upgrading from my 256GB nvme to 1TB... I chose to rebuild from scratch, as there were numerous large programs I no longer used... My old 256GB drive is now D:.
Now, there were a couple of libraries I recall having to customize, in order to get my project to work: ArduinoOTA, Mcufriend (or something like that) l, as well as changing the Mega256 to OptiBoot...
You will find the libraries under the libraries subfolder of the Arduino sketchbook folder. You can find the sketchbook folder location in the Arduino IDE's File > Preferences > Sketchbook location preference.
You can set a custom sketchbook folder location in the Arduino IDE at File > Preferences > Sketchbook location. So you can just set the sketchbook folder location to your project-specific sketchbook folder when you want to use it. This allows you to use the libraries in the normal manner. It also allows you to bundle manually installed boards platforms with your project.
When you put the Arduino IDE in portable mode:
The sketchbook and data directory where boards platforms installed via Boards Manager are installed are under the "portable" subfolder of the Arduino IDE installation. This means that everything is in one folder, including the version of the Arduino IDE the project is compatible with. So this is the method that allows you to truly "save ALL pertinent files of a project".
When asking about "how I installed the software", you are referring to Arduino IDE, I downloaded it from Arduino.cc and installed it the regular way (not portable). I had installed the Windows App in the past on the old SSD, but that led to a world of trouble, before we figured out, why ArduinoOTA wasn't working...
you used GitHub - JAndrassy/my_boards: My Arduino boards custom variants. You can use it as starting point for your boards specialities. for the modified Optiboot with copy_flash_pages function for OTA
@trilife so I think you must have installed Juraj's Optiboot extension boards platform to the hardware subfolder of your sketchbook folder, since that's what Juraj's installation instructions say to do. I already provided instructions for how to determine the location of the sketchbook folder.
Juraj:
you used GitHub - JAndrassy/my_boards: My Arduino boards custom variants. You can use it as starting point for your boards specialities. for the modified Optiboot with copy_flash_pages function for OTA
First of all it is great a pleasure for me to finally join in this illustrious community. I have found out about Platformio project on January of this year and ever since have been using it for many of my arduino projects. I use the Atom Text editor which I found to be extremely easy and intuitive to learn and use.
When I write codes in Arduino IDE, I can split the function bodies from the main ino files into discrete files following a sequential alphabetical naming scheme viz. A.main , B.pid, C.motor etc etc. When I hit the compile button, arduino compiles all these files and their associated header files without any error. Also the other ino files are capable of recognizing public variables, function calls written in libraries by other users installed into the Arduino IDE.
But in platformio, say I make the above files as such, main.cpp, pid.cpp, motor.cpp numerous errors are thrown including missing variable declarations from other libraries, for instance tft declaration of Adafruit GFX library is not recognized in other cpp files EXPECT in the main.cpp file.
Hence though I am not an expert in this subject matter, I strongly believe the platformio community/team should make ONE DEFINITIVE TUTORIAL to teach us less experienced programmers on how to create a multifile arduino project which will do the following
And a header-file (.h) with the function prototype and the struct definition. Arduino.h has to be included so you can use the variable type String. To clean up your project directory you can put the header-file in the include-folder while the source-file (.cpp) should be in the src-folder.
myhelperfunctions.h:
I totally agree. My programming discipline is questionable. I have a lot of multiple .ino projects and I am having a real struggle with getting a clean and manageable structure in Platformio.
At the moment, the Arduino IDE makes them far more readable.
For native C++ programmers, I guess the structure is second nature. For migrants from Arduino, it needs a better explanation - please?
I found that once I had a project working in platformIO that it was easy to navigate to, say a function, because they are all listed. However, I went back to the Arduino IDE for now because I can be get the job done much easier and quicker.
When I next try platformIO I plan to move the code from multiple tabs into one main tab, import that to platform.IO and get it running then maybe break it down into separate .ccp and .h files.
I often change boards in the IDE between UNO and ATtiny85, but when loading an existing file, the board and related settings always reflect what I had loaded previously, rather than the actual board settings for that file.
c80f0f1006