working demo display

This commit is contained in:
Jan-Philipp Warmers 2014-05-17 23:42:44 +02:00
parent ece0961854
commit e1ac064ca9
2 changed files with 14 additions and 13 deletions

View File

@ -75,7 +75,7 @@ LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
# Programming support using avrdude. Settings and variables.
AVRDUDE_PROGRAMMER = usbasp
AVRDUDE_PROGRAMMER = usbtiny
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep

View File

@ -89,24 +89,25 @@ static void set_servo(uint8_t power) {
uint8_t display = 0;
display = power * 10; // shift, since we have to divide by 2,4 (24)
display = display / 24; // instead of dividing by 2,4
display = display + 125;
// display = power * 10; // shift, since we have to divide by 2,4 (24)
// display = display / 24; // instead of dividing by 2,4
// display = display + 125;
display = power;
OCR1A = 2500-display;
}
static void demo_display(void) {
for(uint8_t i = 0; i< 30;i++) {
for(uint8_t i = 0; i< 30;i = i+1) {
set_servo(i*10);
wait(5);
wait(100);
}
for(uint8_t i = 30; i> 0;i--) {
set_servo(i*10);
wait(5);
for(uint8_t i = 10; i>= 0;i = i-1) {
set_servo(i*5);
wait(100);
}
}
@ -120,15 +121,15 @@ int main(void) {
demo_display();
while(1) {
work_uart();
// while(1) {
// work_uart();
if(syscounter >= 10) {
uart_putc('a'); // send a to receive values
set_servo(power_gen);
syscounter = 0;
}
//}
}
return(0);