![](/media/cache/profiles/cc38c8ffd23cef2e3e5c21d20c1db636.jpg.50x50_q85.png)
UDP ROS Communication program
Diff: main.cpp
- Branch:
- test
- Revision:
- 5:2b2cf11243b1
- Parent:
- 4:4b38a500167b
diff -r 4b38a500167b -r 2b2cf11243b1 main.cpp --- a/main.cpp Tue Mar 02 02:15:24 2021 +0900 +++ b/main.cpp Tue Mar 02 02:22:39 2021 +0900 @@ -13,10 +13,12 @@ #define MAX_LEN 1208 char txdata[MAX_LEN]; char rxdata[MAX_LEN]; +long counter = 0; void initialize_txdata() { // 0123...'A''B''C'... for (int i = 0; i < MAX_LEN; i++) - txdata[i] = i % 0x100; + txdata[i] = (i + counter) % 0x100; + counter++; } int network_init() { @@ -57,7 +59,7 @@ void communication() { while (1) { led3 = !led3; - + initialize_txdata(); if (0 > socket.sendto(pcAddr, txdata, sizeof(txdata))) { printf("eth sending error\n"); }