Professional Documents
Culture Documents
#include "pinDefines.h"
#include "USART.h"
int main(void) {
printString("On my way....\r\n");
OCR1A = servoPulseLength;
DDRB |= (1 << PB1); /* re-enable output pin */
_delay_ms(1000);
printString("Releasing...\r\n");
while (TCNT1 < 3000) {;
} /* delay until pulse part of cycle done */
DDRB &= ~(1 << PB1); /* disable output pin */
do {
thousands = hundreds; /* shift numbers over */
hundreds = tens;
tens = ones;
ones = thisChar;
thisChar = receiveByte(); /* get a new character */
transmitByte(thisChar); /* echo */
} while (thisChar != '\r');
transmitByte('\n'); /* newline */
return (1000 * (thousands - '0') + 100 * (hundreds - '0') +
10 * (tens - '0') + ones - '0');
}