adding some docs, adding current software release of display servo

This commit is contained in:
Lucas Pleß 2014-05-27 22:15:00 +02:00
parent 09535d3dfd
commit 720ba155ad
4 changed files with 16 additions and 19 deletions

View File

@ -31,9 +31,7 @@ static void timer_init(void) {
}
static void ports_init(void) {
DDRB |= (1<<PB4)|(1<<PB3);
DDRB |= _BV(PB3);
}
static void process_command() {
@ -85,29 +83,28 @@ static void work_uart() {
}
}
static void set_servo(uint8_t power) {
static void set_servo(uint16_t display) {
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;
display = display * 10; // shift, since we have to divide by 3,2 (32)
display = display / 32; // instead of dividing by 3,2
display = display + 125;
cli(); // read and write atomic
OCR1A = 2500-display;
sei();
}
static void demo_display(void) {
for(uint8_t i = 0; i< 30;i = i+1) {
for(uint8_t i = 0; i< 40;i++) {
set_servo(i*10);
wait(100);
wait(5);
}
for(uint8_t i = 10; i>= 0;i = i-1) {
set_servo(i*5);
wait(100);
for(uint8_t i = 40; i> 0;i--) {
set_servo(i*10);
wait(5);
}
}
@ -121,15 +118,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);

Binary file not shown.

Binary file not shown.

Binary file not shown.