Arduino: Data and another change of plans

After speaking to PhD. Koch about incorporating the blinking of the LEDs I decided to not go with the incorporation of the blinking LEDs. At first I thought this would be settling for something really basic and kind of boring; something that didn’t really demonstrate any kind of special  purpose for the arduino.
However, I explained how I felt like I needed more time to get to know how to program the arduino better to successfully incorporate this part. My problem was that I wasn’t able to turn the leds on or off when I incorporated the blinking part.
I think by presenting this basic project well, I’ll be able to build on it, which is something I really want to work on this summer! Furthermore, by reflecting on the process it took me to figure out the switch, I realized that it was not a completely trivial project for me and I actually learned quite a bit.

I followed this  video to program the button and learned about debugging and how to incorporate it into the code.
This is the code I ended up using:


nt switchPin=8;// This is the pin the switch is connected to

int ledPina=7;//These are the pins the LEDs are connected to
int ledPinb=6;
int ledPinc=5;
int ledPind=4;
int ledPine=3;
boolean lastButton=LOW;// Keeps track of the value of the button in the previous loop
boolean ledOn=false;// Keeps track of the current state of the LED
boolean currentButton =LOW;// Keeps track of the current button value(Use it with debounce function)

void setup ()
pinMode(switchPin, INPUT);
pinMode(ledPina, OUTPUT);
pinMode(ledPind, OUTPUT);
pinMode(ledPine, OUTPUT);

boolean debounce (boolean last)// Creates a function called debounce with input last
boolean current =digitalRead (switchPin);// Determines the current value of the switch

if (last !=current)//
delay(5);// Gives switch enough time to finish debouncing
current=digitalRead(switchPin);// Here it’s read again, presuming that it’s at a steady value
return current;//This returns the steady value

void loop()
if (lastButton==LOW && currentButton== HIGH)
ledOn=!ledOn; //inverts the value of LED from what it previously was

lastButton= currentButton;// Gets set to current button
This is the data I took (It can also be seen on figshare ):

pin # Input Voltage (LED off) Input Voltage(LED on)  Output voltage (LED off) Output voltage( LED on) 
8 (switch) 5v 5v 5v 5v
7 3.6mv 4.64v 3.6mv 1.87v
6 3.6mv 4.64 3.6mv 1.92v
5 3.3mv 4.66v 3.3mv 2.05v
4 5.3mv 4.74v 5.3mv  2.34v

Leave a Reply

Your email address will not be published. Required fields are marked *