Arduino, Yay!

I made some silly mistakes while working on this lab. I've learned that I stuck one of my breadboards on backwards, resulting in annoyingly different labeling. One has positive + negative rails and the other has negative + positive. So that would explain why nothing was working. Doh.

Now that that's settled, I started by connecting the LEGO minifigure switch as a digital input and the transistor as a digital output. That worked out wonderfully. Before I followed the lab (in class & at home) I did notice that I have a bad habit of attaching switches with one wire to the digital input and the other to ground. So no resistor. I don't exactly understand the reasoning of the correct method as my invented method has worked fine for me in the past. Does anyone know? Does something about the Arduino internal pull up resistors go here? Next I went to exploring analog inputs. Here too I had made a silly mistake. I couldn't figure out why my soft potemoeter wouldn't report it's default state as 0. The trick was that I didn't have a 10K resistor between ground and the input (I had it connected just between the sensor and the analog in on the Arduino.
I thought it would be cool to be able to decide lots of bubbles or not-lots of bubbles on a sliding scale. The analog input isn't exactly a clean number, so I did a bit of googling and found information on smoothing the input. I incorporated that learning into my code. Everything worked! I included the LED to get a better idea of what was being sent to the transistor.   Here is the delicious code:

© 2017. Some Rights Reserved.

Ghostium Theme by @oswaldoacauan

Proudly published with Ghost