Part C. Make it yours - darenl/etch-a-sketch GitHub Wiki
1. Upload video of your Etch-a-Sketch in action, being used by someone else in the class!
Attempt No. 2 (Trying to make a sword)
2. Own Feature
For my feature, I added an additional potentiometer to get a value between 0 and 1023. Then, I map this value to a range of 0 and 255. This value is sent to the Raspberry Pi to alter the color of the lines. The R, G, and B values are adjusted by this potentiometer value multiplied by some constant between 0 and 1.
var ranValue = data[2];
var r = 255 - ranValue;
var g = 255 - Math.floor(ranValue/2);
var b = 255 - Math.floor(ranValue/3);
COLOUR = "#" + r.toString(16) + g.toString(16); + b.toString(16);
data
represents the array passed from the Arduino to the Raspberry Pi, with the value at index 2 being the potentiometer value.