summaryrefslogtreecommitdiff
path: root/comm/i2c/i2c_arduino_master
diff options
context:
space:
mode:
authorAbel Tim <abel@main.home>2024-06-22 09:17:50 +0200
committerAbel Tim <abel@main.home>2024-06-22 09:17:50 +0200
commit4971e86d05c714ff3630ada8851938614128b412 (patch)
tree35a40d4213bd8bcb47da35ef7a477ae37b28cf05 /comm/i2c/i2c_arduino_master
parentbec80cbf5f05e2faeeda15b7a8b372d1a3f8e465 (diff)
downloadrobotica-4971e86d05c714ff3630ada8851938614128b412.tar.gz
robotica-4971e86d05c714ff3630ada8851938614128b412.zip
update repo structure
update poster add code flowchart
Diffstat (limited to 'comm/i2c/i2c_arduino_master')
-rw-r--r--comm/i2c/i2c_arduino_master/i2c_arduino_master.ino36
1 files changed, 0 insertions, 36 deletions
diff --git a/comm/i2c/i2c_arduino_master/i2c_arduino_master.ino b/comm/i2c/i2c_arduino_master/i2c_arduino_master.ino
deleted file mode 100644
index ff960ed..0000000
--- a/comm/i2c/i2c_arduino_master/i2c_arduino_master.ino
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <Wire.h>
-#define BAUD_RATE 19200
-#define CHAR_BUF 128
-
-void setup() {
- Serial.begin(BAUD_RATE);
- Wire.begin();
- delay(1000); // Give the OpenMV Cam time to bootup.
-}
-
-void loop() {
- int32_t temp = 0;
- char buff[CHAR_BUF] = {0};
-
- Wire.requestFrom(0x12, 2);
- if(Wire.available() == 2) { // got length?
-
- temp = Wire.read() | (Wire.read() << 8);
- delay(1); // Give some setup time...
-
- Wire.requestFrom(0x12, temp);
- if(Wire.available() == temp) { // got full message?
-
- temp = 0;
- while(Wire.available()) buff[temp++] = Wire.read();
-
- } else {
- while(Wire.available()) Wire.read(); // Toss garbage bytes.
- }
- } else {
- while(Wire.available()) Wire.read(); // Toss garbage bytes.
- }
-
- Serial.print(buff);
- delay(1); // Don't loop to quickly.
-}