This is my blog post for working on week 2's labs.
Based on my experience doucmenting last week, I modified my set up significantly from last week. My camera is now mounted over my work. Here's what what looks like:
Here's what it looks like when I'm getting out supplies:
💡💡💡
For this lab, I didn't run into any issues building this, EXCEPT that
initially I couldn't get the connection between the computer and the
Arduino to work at all. After some time of trying all kinds of software
fixes, I realized that the issue was that I was using a bad micro-USB
cable. Turns out only some of the transfer data.
https://itp.nyu.edu/physcomp/labs/labs-arduino-digital-and-analog/analog-in-with-an-arduino/
Also ran into no issues with the lab.
💡💡💡
This is the first exercise so far where the code isn't included.
Here's the critical part of the code I wrote:
int in = analogRead(A0); int out = 255 - map(in, 0, 10, 0, 255); if (out < 0) { out = 0; } analogWrite(ledPin, out);
I had to experiment a bit to get a useful relationship between the input and output values. I chose to invert the relationship, turning the device into a night-light!
Pretty straightforward.