Virtual Swatch
In this assignment I'm going to make a virtual swatch with Processing and Arduino by using the analog sensor I've made in week 6.
Software i used
Arduino
Processing
Hardware i used
Breadboard
100K ohm resistor
NodeMCU
LDR
Analog sensor from week 6
7 cables to connect everything
Inspiration
At first I've looked through te examples from Processing for inspiration and came across this example I want to combine with Arduino.
By tweaking the values with my analog sensor i want to create more triangles so it will turn into a big circle, the same for the other way around.
Visually, I want it to look like it fits this series:
Arduino
The Arduino code looks like this:
I can use this code for the LDR and for the analog sensor I've made because i only want to read the values. The value is also mapped to 0 - 255 instead of 0 - 1023. I uploaded this code to the NodeMCU.
Schematic:
For the first time to make sure it works i will use the LDR instead of the analog sensor I made.
Processing
For the code I've combined the example code with the code I used the first time in Processing. This was the trickiest part because i was not sure what to change. After a few hours i finally figuered out to make it work with the LDR and giving the right values so there will be more triangles or less.
The last thing in processing i needed to do was to make sure the visual will fit in the serie. It finally looked like this:
The final code in Processing:
Final results
First i tried it with a LDR and it worked.
Next i tried it with the analog sensor I've made for week 6 and i was very happy to see it working!
Last updated