Added blink script.
This commit is contained in:
parent
38cd2efb0a
commit
e480b46e47
16
src/gympal.c
16
src/gympal.c
|
@ -1,15 +1,19 @@
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include <util/delay.h>
|
#include <util/delay.h>
|
||||||
|
|
||||||
|
void updatePin12(uint8_t status) {
|
||||||
|
PORTB = status << PORTB4;
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
// Pin 12 == Port B4, aka 4th bit on the B register.
|
// Pin 12 == Port B4, aka 4th bit on the B register.
|
||||||
// Set pin 12 as output.
|
// Set pin 12 as output.
|
||||||
DDRB = 1 << PORTB4;
|
DDRB = 1 << PORTB4;
|
||||||
// Set pin 12 as HIGH.
|
uint8_t ledOn = 1;
|
||||||
PORTB = 1 << PORTB4;
|
while (1) {
|
||||||
// Delay for 1 second.
|
updatePin12(ledOn);
|
||||||
_delay_ms(1000.0);
|
ledOn = !ledOn;
|
||||||
// Set pin 12 as LOW.
|
_delay_ms(1000.0);
|
||||||
PORTB = 0 << PORTB4;
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue