Tweak the Logo: Using serial connection and the processing app to make a background change color

     This project was based around using the Processing coding software in conjunction with Serial.write monitering the current angle of a potentiometer to change the background color on the Arduino logo.


The components here are super simple, just being the potentiometer and the Arduino itself. The potentiometer works by outputting the current angle that is twisted to. It is connected to the power and ground, and its output pin is connected to the Analog 0 slot, which is needed to convey the exact degree it is at.



This is by far the most complicated coding I have ever done on any of the Arduino projects, for two reasons. The first is that this time we had to use two applications, one being the Arduino IDE which had a simple code uploaded that just wrote the current value of A0/4 to the monitor. The tough part came in when we needed to use a secondary coding platform, "Processing", in order to modify the background color of the Arduino logo.

This project was based around using Serial communication for outside programming, so it makes sense why we needed the outside language that would read the Serial information from the Arduino. But when I initially plugged in all the code into the machine, it didn't work, and instead had an output of errors.

The Processing side first gave me an error saying it couldn't find the "logo" through the http, so I decided to just download the .png and process it through my file. Then, the output from the potentiometer was acting wonky, so I went through a large process of trial, error, and debugging to find the solution. I upped the delay to 10 just to give the code more time to process as it went from the Arduino to the processing app, but that didn't work, so I decided to look up my problem online and use AI to see if I could find the problem.

I found a solution online where the /4 was the problem, so someone just mapped the numbers and it worked for them (0 -> 0, 1023 -> 255). ChatGPT said I should typecast the Serial.list in the Processing side into an object, and when I did both of those, the program worked.




This project was definitely the most difficult and I think shows the issues with the current Arduino project book that we have. There are a ton of outdated issues and bugs in the code that are not addressed, and can make you think your project wouldn't work at all if you didn't dive further into it. Even basic things such as the resistor bands not being the same can be super confusing, and for someone with less knowledge it can be a big roadblock and make them stop, which is why I think Arduino really needs to update their book going foreward.

This project was a great way to show us how to use exterior languages and programs with our Arduino, rather than just the basic sensors and IDE. This project, along with the partner one for this week, show the software and hardware side of using the Arduino to edit exterior programs, applications, objects, and items.



Comments

Popular posts from this blog

P1 Completed Project Post

Final Project: Reusing the Snake board design to create Tetris with the Arduino