Beginners: please read this post and this post before posting to the forum.
0 Members and 1 Guest are viewing this topic.
Quote from: Jdog on March 01, 2009, 12:50:55 AMQuote from: Razor Concepts on February 28, 2009, 12:44:46 PMYou can learn Visual Basic, create a computer program that can read whatever keystrokes you want and output them (including arrays) to the Axon.How would you have the axon receive an array from the computer.code here:http://www.societyofrobots.com/axon/axon_function_list.shtml#uart(the part that mentions GPS and Blackfin)
Quote from: Razor Concepts on February 28, 2009, 12:44:46 PMYou can learn Visual Basic, create a computer program that can read whatever keystrokes you want and output them (including arrays) to the Axon.How would you have the axon receive an array from the computer.
You can learn Visual Basic, create a computer program that can read whatever keystrokes you want and output them (including arrays) to the Axon.
char cByte;void control(void) { robot_stop(); while(1) { cByte=uart1GetByte(); //get byte from UART0 on the axon { if (cByte == 'w') robot_forward(); if (cByte == 'a') robot_left(); if (cByte == 'd') robot_right(); if (cByte == 's') robot_backward(); while (cByte == '-1') robot_stop(); wheel_left(left_wheel); wheel_right(right_wheel); rprintf("L_Wheel:%d%d R_Wheel:%d%d\r\n",left_wheel, right_wheel); delay_ms(50); } } }
//remote controlled ERP code char cByte; rprintfInit(uart3SendByte); while(1) { cByte=uart3GetByte(); //get byte from UART0 on the axon if(cByte!=-1)//no new data { if (cByte == 'w') { wheel_left(400); wheel_right(1100); } if (cByte == 's') { wheel_left(1100); wheel_right(400); } if (cByte == 'd') { wheel_left(400); wheel_right(400); } if (cByte == 'a') { wheel_left(1100); wheel_right(1100); } if (cByte == 'o') { LED_on(); } if (cByte == 'p') { LED_off(); } delay_ms(25); } }
That doesn't work. For some reason even when I don't call the movement functions they still follow the last one called, or maybe it's that the axon doesn't recieve the -1.
Also, how could it recieve a -1 if it's supposed to store cByte as a character?
if(cByte!=-1)//no new data
QuoteThat doesn't work. For some reason even when I don't call the movement functions they still follow the last one called, or maybe it's that the axon doesn't recieve the -1.But it *does* work, my video proves it
char cByte;int iByte;void control(void) { robot_stop(); while(1) { cByte=uart1GetByte(); //get byte from UART1 on the axon iByte=cByte; if (cByte!='255') { if (cByte == 'w') robot_forward(); if (cByte == 'a') robot_left(); if (cByte == 'd') robot_right(); if (cByte == 's') robot_backward(); wheel_left(left_wheel); wheel_right(right_wheel); } else robot_stop(); rprintf("L_Wheel:%d%d R_Wheel:%d%d cByte:%c iByte:%d\r\n",left_wheel, right_wheel, cByte, iByte); delay_ms(50); } }
cByte=uart1GetByte(); //get byte from UART1 on the axon iByte=cByte; if (cByte!='255')
cByte=iByte=uart1GetByte(); if (iByte!='-1')
cByte!='255'
iByte!=-1