feat: sketch scaffold with I2C bus bring-up and scanner

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-17 19:30:34 +07:00
co-authored by Claude Opus 4.8
parent ffb2ac3756
commit 074bc99875
2 changed files with 61 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
#include <Arduino.h>
#include <Wire.h>
#include "config.h"
static void i2cScan() {
Serial.println(F("I2C scan:"));
byte found = 0;
for (byte addr = 1; addr < 127; addr++) {
Wire.beginTransmission(addr);
if (Wire.endTransmission() == 0) {
Serial.printf(" device at 0x%02X\n", addr);
found++;
}
}
Serial.printf(" %d device(s) found\n", found);
}
void setup() {
Serial.begin(115200);
delay(200);
Serial.println(F("\n=== Weather Predictor booting ==="));
Wire.begin(I2C_SDA, I2C_SCL); // MUST come before any I2C driver begin()
i2cScan();
}
void loop() {
}