Squirrels have fuzzy tails.
0 Members and 1 Guest are viewing this topic.
if (characterFromCamera = uart2GetByte() != -1)//check for data { do stuff }
int temp;if ((temp = uart2GetByte()) != -1)//check for data { characterFromCamera = temp; do stuff }
int temp = uart2GetByte();if (temp != -1)//check for data{ characterFromCamera = temp; do stuff}
char car_id;int temp;while(1) { temp=uart3GetByte(); rprintf("temp: %d\r\n",temp); car_id=temp; rprintf("car ID: %d\r\n",car_id); if (temp != -1)//check for data { car_id=temp; rprintf("car ID transmitted: %d\r\n",car_id); break; } }
rprintf("car ID transmitted: %d\r\n",car_id);
rprintf("car ID transmitted: %c\r\n",car_id);
// transmit a character to the UART.// note that this routine doesn't use interrupts. // program execution will pause here if the UART is busy until cleared.void output_ch_0 (char data) { wdt_reset(); while (!(UCSRA & (1<<UDRE))) { } UDR = data; return; }
%d returns the numerical value of a variable.if you want this translated into the ASCII value you want to use %c
/// Called by rprintf() - does a simple printf (supports %d, %x, %c). /// Supports: /// - %d - decimal /// - %x - hex /// - %c - character
345as? you are sending a string and trying to place it into a single bytethe decimal value of the ASCII character "3" is 51