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

Talk about the fourth PyroEDU course here.
ThePyroElectro
Posts: 1181
Joined: Mon Nov 12, 2007 9:24 pm
Location: Earth
Contact:

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

A new lesson was posted today:
http://www.pyroelectro.com/edu/microcontrollers/led_game/

little_cowboy
Newbie Pyro
Posts: 7
Joined: Mon Nov 04, 2013 12:32 am

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

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.

ThePyroElectro
Posts: 1181
Joined: Mon Nov 12, 2007 9:24 pm
Location: Earth
Contact:

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

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.