Hi Ben,
I just made a sample program to send data from UART to a Sensor.
Could tell me if this is the good way to send data a the good baud rate or do you have a better way even without LUT, with a string or EEPROM etc...
Way to send data from UART
-
- Posts: 217
- http://meble-kuchenne.info.pl
- Joined: Thu Sep 23, 2021 3:44 pm
- Location: France
- Has thanked: 35 times
- Been thanked: 26 times
-
- Matrix Staff
- Posts: 1956
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 511 times
- Been thanked: 700 times
Re: Way to send data from UART
Hello,
That looks good to me. It really depends on if you need to be able to send different things.
As the data is fairly small you could send as a string using the following fixed string parameter. Sending as a string won't allow you to pass the value 0x00.
"\x64\x69\x03\x5E\x4E"
Or you could pop the values into a byte array and send the array. This will allow you to send the value 0x00.
data[0] = 0x64
data[1] = 0x69
etc
That looks good to me. It really depends on if you need to be able to send different things.
As the data is fairly small you could send as a string using the following fixed string parameter. Sending as a string won't allow you to pass the value 0x00.
"\x64\x69\x03\x5E\x4E"
Or you could pop the values into a byte array and send the array. This will allow you to send the value 0x00.
data[0] = 0x64
data[1] = 0x69
etc
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Posts: 217
- Joined: Thu Sep 23, 2021 3:44 pm
- Location: France
- Has thanked: 35 times
- Been thanked: 26 times
Re: Way to send data from UART
hi Ben,
I did different test 1- SendString like you proposed to me:
Data are well send in simulation but can not compile program , Failed attached log file
2- I don't know if data are sent to UART and there is no data in console, is it normal ?
3- Data sent and can be compiled
Could you check point 1 and 2 please
Another point without link with this
C:/esp-idf/components/esp_event/include/esp_event_loop.h:2:2: warning: #warning "esp_event_loop.h is deprecated, please include esp_event.h instead" [-Wcpp]
#warning "esp_event_loop.h is deprecated, please include esp_event.h instead"
thx
I did different test 1- SendString like you proposed to me:
Data are well send in simulation but can not compile program , Failed attached log file
2- I don't know if data are sent to UART and there is no data in console, is it normal ?
3- Data sent and can be compiled
Could you check point 1 and 2 please
Another point without link with this
C:/esp-idf/components/esp_event/include/esp_event_loop.h:2:2: warning: #warning "esp_event_loop.h is deprecated, please include esp_event.h instead" [-Wcpp]
#warning "esp_event_loop.h is deprecated, please include esp_event.h instead"
thx
- Attachments
-
- send to UARTV01.fcfx
- (10.78 KiB) Downloaded 365 times
-
- send to UARTV01.msg.txt
- (16.3 KiB) Downloaded 444 times
Seb
-
- Valued Contributor
- Posts: 490
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 84 times
- Been thanked: 265 times
Re: Way to send data from UART
re your first post - you need to remove the final \ character in send string
re second post - I don't see any errors, the compile and flash to device looks like it all worked ok
There are quite a few warnings, but these are normal (for now) and can be ignored.
re second post - I don't see any errors, the compile and flash to device looks like it all worked ok
There are quite a few warnings, but these are normal (for now) and can be ignored.
-
- Posts: 217
- Joined: Thu Sep 23, 2021 3:44 pm
- Location: France
- Has thanked: 35 times
- Been thanked: 26 times
Re: Way to send data from UART
Yes you are right !
Yes without final \ character in send string, no error.
Thx
Seb