Wednesday, February 10, 2016

Arduino Labs

Blinking LED circuit with Arduino

Switch and LED circuit with Arduino

1 Move the wire that connects to pin 3 before the switch (in parallel, not in series). This way, when the switch is not pressed, pin 3 receives 1 as its digital input (the large analog input translates to a digital input of 1), and when the switch is pressed, pin 3 receives 0 as its digital input (a smaller analog input than before translates to a digital input of 0). The key with this scenario is to know the cutoff point between analog to digital translation of analog values.

Potentiometer and LED circuit with Arduino

1 0 V
2 5 V.
3 5000 ohms
4 Arduino gives us an output range from 0-1023. But the input we must give it must range from 0-255. So there's a simple mapping from output (x) to input (y) that is y = x >> 2 (or x * 0.25).

Potentiometer and speaker circuit with Arduino

1 Only if the speaker has a low resistance. But if it has a non-low resistance (which it does), then it's fine. Not only that, we're not doing a direct write to the speaker, but instead using the tone() function. My guess is that this drastically lowers the voltage given to the circuit (rather than on a scale of 0-5V, probably something like 0-0.1V).
2 Put some more speakers. Don't increase the voltage (too much) on the circuit containing the speakers otherwise you'll blow them (I did this with my headphones, and they started crackling after a few days).
3 I wish I had a more organized system of keeping wires/resistors/etc.

Photoresistor and speaker circuit with Arduino

1 Put the wire that leads to pin A0 after the photoresistor (in parallel, not in series).

No comments:

Post a Comment