Squirrels have fuzzy tails.
0 Members and 1 Guest are viewing this topic.
int main(void){int left_side = 0;int go_back = 45;int go_forward = 90int stop = 64;uartInit();rprintfInit(uart0SendByte);uartSetBaudRate(left_side, 38400);while(1){uart0SendByte(go_forward);delay_ms(60000); //delay 1 minuteuart0SendByte(stop);delay_ms(60000); // 1 minute delayuart0SendByte(go_back);delay_ms(60000); // 1 minute delay} // end whilereturn 0;} // end main
int i=0;uartInit();rprintfInit(uart2SendByte);uart2SendByte(go_forward);while(i<10){i++;}uart2SendByte(stop);i=0;while(i<10){i++;}uart2SendByte(go_back);i=0;while(i<10){i++;}
Instead of 'go_forward', 'stop', and 'reverse', try using numbers.Also, its a good idea to attach uart0 to Hyperterminal and see what it outputs.
Use your serial to USB adaptor.
or perhaps have the USB uart be a "copy" of the uart you are using.For example if your uart is outputing "1" then the USB uart should also be transmitting "1"Then just open up Hyperterminal( or Bray Terminal, my favorite ) and see whats really getting sent out
uartSetBaudRate(0, 38400);uartSetBaudRate(1, 38400);while(1){rprintfInit(uart0SendByte);uart0SendByte(80);i=0;while(i<120){i++;}i=0;rprintfInit(uart1SendByte);uart1SendByte(80);while(i<120){i++;}i=0;}
int main(void){int go_back, go_forward, stop;go_back = 45;go_forward = 80;stop = 64;uartInit();uartSetBaudRate(0, 38400);timer0Init(); // very important to initialize timerswhile(1) {rprintfInit(uart0SendByte);uart0SendByte(go_forward);delay_ms(500);delay_ms(500);delay_ms(500);rprintfInit(uart0SendByte);uart0SendByte(stop);delay_ms(500);delay_ms(500);delay_ms(500);rprintfInit(uart0SendByte);uart0SendByte(go_back);delay_ms(500);delay_ms(500);delay_ms(500);}//end whilereturn 0;}//end main
while(i<1200000){i++;} didnt' work
Quotewhile(i<1200000){i++;} didnt' workYour i was probably initialized as an int, meaning it can't go higher than 255.Remember to *always* output with USB to debug your problem, even before posting here. You would have easily found the timing problem when you saw no delay in the output to hypterminal