UDP ROS Communication program

Files at this revision

API Documentation at this revision

Comitter:
daikinect
Date:
Tue Mar 02 02:22:39 2021 +0900
Branch:
test
Parent:
4:4b38a500167b
Commit message:
date change test

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
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");
     }