Networking and communication allow embedded devices to share data with sensors, displays, and other microcontrollers. Instead of working alone, devices can communicate over protocols like I²C, SPI, UART, and CAN to build more complex systems.
I²C (Inter-Integrated Circuit) is a two-wire communication protocol widely used in embedded programming. It uses:
Multiple devices can share the same SDA and SCL lines, each with a unique address. This makes I²C efficient for connecting many peripherals using only two pins.
For this weeks exploration i tried a couple variations
void setup() {
Serial.begin(115200);
}
void loop() {
int minVal = 4095, maxVal = 0;
// Sample for 200ms
unsigned long start = millis();
while (millis() - start < 200) {
int val = analogRead(A0);
if (val < minVal) minVal = val;
if (val > maxVal) maxVal = val;
}
Serial.print("Min: "); Serial.print(minVal);
Serial.print(" Max: "); Serial.print(maxVal);
Serial.print(" Range: "); Serial.println(maxVal - minVal);
delay(100);
}