Browse Source

using sprintf on Arduino

tth 2 years ago
parent
commit
1e2a5e9f31
1 changed files with 6 additions and 7 deletions
  1. 6
    7
      simulator/send-random/send-random.ino

+ 6
- 7
simulator/send-random/send-random.ino View File

@@ -36,14 +36,13 @@ void updatevalues(void)
36 36
 void sendvalues(void)
37 37
 {
38 38
   int foo;
39
+  char ligne[100];
39 40
 
40
-  Serial.print("X");
41
-  for (foo=0; foo<NBVAL; foo++) {
42
-    Serial.print(" ");
43
-    Serial.print(values[foo]);
44
-    }
45
-  Serial.print("\n");
46
-}
41
+  sprintf(ligne, "X %d %d %d %d",
42
+        values[0], values[1],values[2],values[3]);
43
+
44
+  Serial.println(ligne);
45
+}  
47 46
 /* -------------------------------------------------- */
48 47
 
49 48
 void loop() {

Loading…
Cancel
Save