diff options
| author | Abel Tim <abel.tim.t@gmail.com> | 2025-03-23 16:33:05 +0100 |
|---|---|---|
| committer | Abel Tim <abel.tim.t@gmail.com> | 2025-03-23 16:33:05 +0100 |
| commit | 6b328bb4ca0184dc39f0184d1ad2f47b46e5d6d7 (patch) | |
| tree | dae91189524571de504d01f655e7a953d6551b54 /code/debug/communication/tx/tx_rand_XIAO/src | |
| parent | 59abac3480502b90c4cff17625ba29329dc461bf (diff) | |
| download | robotica-6b328bb4ca0184dc39f0184d1ad2f47b46e5d6d7.tar.gz robotica-6b328bb4ca0184dc39f0184d1ad2f47b46e5d6d7.zip | |
serial
Diffstat (limited to 'code/debug/communication/tx/tx_rand_XIAO/src')
| -rw-r--r-- | code/debug/communication/tx/tx_rand_XIAO/src/main.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/code/debug/communication/tx/tx_rand_XIAO/src/main.cpp b/code/debug/communication/tx/tx_rand_XIAO/src/main.cpp new file mode 100644 index 0000000..3e9444b --- /dev/null +++ b/code/debug/communication/tx/tx_rand_XIAO/src/main.cpp @@ -0,0 +1,55 @@ +// code to send random numbers via the seeed XIAO's Serial1 port +#include <Arduino.h> + +long rn1; +long rn2; +long rn3; +long rn4; +long rn5; +long rn6; +long rn7; +long rn8; + + +void setup() { + Serial.begin(9600); + Serial1.begin(9600); + Serial.println("Starting loop"); + + randomSeed(analogRead(0)); +} + +void loop() { + rn1 = random(1500); + rn2 = random(1500); + rn3 = random(1500); + rn4 = random(1500); + rn5 = random(1500); + rn6 = random(1500); + rn7 = random(1500); + rn8 = random(1500); + + Serial1.print("S"); + //Serial1.print("B"); + Serial1.print(rn1); + Serial1.print(", "); + Serial1.print(rn2); + Serial1.print(", "); + Serial1.print(rn3); + Serial1.print(", "); + Serial1.print(rn4); + Serial1.print(", "); + Serial1.print(rn5); + Serial1.print(", "); + Serial1.print(rn6); + Serial1.print(", "); + Serial1.print(rn7); + Serial1.print(", "); + Serial1.println(rn8); + Serial.println("R"); + //Serial1.print("E"); + + + delay(250); + +}
\ No newline at end of file |
