Page 1 of 1

### #8 Design An LED Game [Post Homework Here]

Posted: Thu May 01, 2014 7:14 pm
A new lesson was posted today:
http://www.pyroelectro.com/edu/microcontrollers/led_game/

### Re: #8 Design An LED Game [Post Homework Here]

Posted: Wed May 21, 2014 2:20 am
1. The trimpot acts as a voltage divider varying the voltage going to A0 from 0 to 5 volts, which A0 translates to a value between 0 and 1023. This value is divided by 4 to obtain a milliseconds value which is used as an argument in the delay function, timing the transition between LEDs.

2. The 4026 acts as a one digit counter/led segment driver. When pin 1 (clock) of the 4026 receives a pulse from pin D13 of the Atmel chip, it increments the count by 1.

3. The 10K resistor and the .1 ufd cap go from D3 to +5v instead of ground, leaving D3 high. The other leg of the pushbutton goes to ground instead of +5v so that when the button is pressed, D3 makes a transition from high to low, hence falling/

You also need to change the program line to:

attachInterrupt(1, winner_check, FALLING);

I thought this was a great lesson. Just for fun, I added a Serial.begin(9600); line to the setup section and in the main logic loop inserted Serial.println(analogRead(a0)); and Serialprintln(adc_val); lines so that I could turn on the serial monitor in the Arduino program editor and see the values change as I adjusted the trimpot while the program was running.

### Re: #8 Design An LED Game [Post Homework Here]

Posted: Fri May 30, 2014 5:09 pm
little_cowboy wrote:You also need to change the program line to:

attachInterrupt(1, winner_check, FALLING);

I thought this was a great lesson. Just for fun, I added a Serial.begin(9600); line to the setup section and in the main logic loop inserted Serial.println(analogRead(a0)); and Serialprintln(adc_val); lines so that I could turn on the serial monitor in the Arduino program editor and see the values change as I adjusted the trimpot while the program was running.