Skip to content
Snippets Groups Projects
Commit 699c19d2 authored by Fausto Agustin Navadian Benitez's avatar Fausto Agustin Navadian Benitez :call_me_tone3:
Browse files

Test sending one float

parent 55c3d3ff
No related branches found
No related merge requests found
......@@ -129,7 +129,12 @@ static void callback_odometry(){
float_buffer[3] = o->y_dot;
float_buffer[4] = o->phi;
float_buffer[5] = o->phi_dot;
uart_write_bytes(UART_NUM_2, float_buffer, sizeof(float_buffer));
uart_write_bytes(UART_NUM_2, &float_buffer[0], sizeof(float));
uart_write_bytes(UART_NUM_2, &float_buffer[1], sizeof(float));
uart_write_bytes(UART_NUM_2, &float_buffer[2], sizeof(float));
uart_write_bytes(UART_NUM_2, &float_buffer[3], sizeof(float));
uart_write_bytes(UART_NUM_2, &float_buffer[4], sizeof(float));
uart_write_bytes(UART_NUM_2, &float_buffer[5], sizeof(float));
free(v);
}
......
......@@ -27,7 +27,7 @@
static const char *tag = "UART EVENT";
#define UART_NUM UART_NUM_2
#define FLOAT_BUF_SIZE 4
#define FLOAT_BUF_SIZE 1
#define BUF_SIZE FLOAT_BUF_SIZE * sizeof(float)
#define TASK_MEMORY 1024 * 2
......@@ -51,7 +51,7 @@ static void uart_task(void *pvParameters)
if (len == BUF_SIZE){
memcpy(&fdata, data , sizeof(fdata));
printf("%s \n",data);
for (int i = 0; i < 4; i++)
for (int i = 0; i < FLOAT_BUF_SIZE; i++)
{
printf("El dato %d en float es: %f \n",i, fdata[i]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment