Change the world

The following example programs are available to demonstrate the basic principles of input, output and delays:


Example program that turns on 8 LEDs for 250ms, then off for 250ms, repeatedly



Example program that turns on an LED for 400ms, then off for 400ms, repeatedly.



Reads the value of 8 switches and displays this value on 8 LEDs   



Reads the value of button and then turns an LED on when the button is on otherwise the LED is turned off. 



Reads the value of 8 switches on PORTB (using the internal pullup resistors) and displays this value on 8 LEDs. 



Reads the value of 3 switches and then controls the output of 8 LEDs as follows:

                  SW2 SW3 SW0 LEDs (0=OFF, 1=ON)

                   0   0   0  00000000

                   0   0   1  00001111

                   0   1   0  11110000

                   0   1   1  11111111

                   1   0   0  10101010

                   1   0   1  10101010

                   1   1   0  10101010

                   1   1   1  10101010



Increments a counter from 0 to 255 repeatedly in 200ms delays and display the count value on 8 LEDs



Increments a counter from 0 to 255 when a button is pushed and released. The count value is displayed on 8 LEDs.  Due to the contact bounce effect on the button, the counter will count fairly inconsistend.  The example ex9_button_count_debounce.c will solve this.



This is the upgrade of ex8_button_count.c to compensate for the debounce effect on the pushbutton which causes the inconsistend counting.



Same as ex9_button_count_debounce.c, but uses a user defined function is_button_pressed() to debounce the input pushbutton's state.