Started following some tutorial on att85 usi. Downloaded example code from make avr book.
This commit is contained in:
34
Make AVR Examples/Chapter03_Digital-Output/povToy/povToy.c
Normal file
34
Make AVR Examples/Chapter03_Digital-Output/povToy/povToy.c
Normal file
@@ -0,0 +1,34 @@
|
||||
// POV toy demo framework //
|
||||
|
||||
// ------- Preamble -------- //
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
// -------- Functions --------- //
|
||||
void POVDisplay(uint8_t oneByte) {
|
||||
PORTB = oneByte;
|
||||
_delay_ms(2);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
// -------- Inits --------- //
|
||||
DDRB = 0xff; /* Set up all of LED pins for output */
|
||||
// ------ Event loop ------ //
|
||||
while (1) { /* mainloop */
|
||||
POVDisplay(0b00001110);
|
||||
POVDisplay(0b00011000);
|
||||
POVDisplay(0b10111101);
|
||||
POVDisplay(0b01110110);
|
||||
POVDisplay(0b00111100);
|
||||
POVDisplay(0b00111100);
|
||||
POVDisplay(0b00111100);
|
||||
POVDisplay(0b01110110);
|
||||
POVDisplay(0b10111101);
|
||||
POVDisplay(0b00011000);
|
||||
POVDisplay(0b00001110);
|
||||
|
||||
PORTB = 0;
|
||||
_delay_ms(10);
|
||||
} /* end mainloop */
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user