Distancer/Distancer.cpp

47 lines
604 B
C++
Raw Normal View History

2017-02-19 14:04:43 +00:00
#define F_CPU 1000000
2017-02-19 11:56:01 +00:00
#include <avr/io.h>
2017-02-19 14:04:43 +00:00
#include <util/delay.h>
2017-02-19 11:56:01 +00:00
#include "LcdShiftReg.h"
2017-02-19 11:56:01 +00:00
void setupStatusLed()
2017-02-19 14:04:43 +00:00
{
DDRB |= (1 << PB0);
}
void flashStatusLed()
{
PORTB |= (1 << PB0);
_delay_ms(100);
PORTB &= ~(1 << PB0);
}
2017-02-19 11:56:01 +00:00
int main()
{
setupStatusLed();
LcdShiftReg lcdShiftReg;
2017-02-19 14:04:43 +00:00
2017-02-19 11:56:01 +00:00
while (true)
{
2017-02-19 14:04:43 +00:00
flashStatusLed();
_delay_ms(400);
lcdShiftReg.set(1);
_delay_ms(100);
lcdShiftReg.set(0);
_delay_ms(400);
lcdShiftReg.set(1 << 1);
_delay_ms(100);
lcdShiftReg.set(0);
_delay_ms(400);
lcdShiftReg.set(1 << 7);
_delay_ms(100);
lcdShiftReg.set(0);
_delay_ms(400);
2017-02-19 11:56:01 +00:00
}
}