ESP8266-Nodemcu-D1-Mini
Verfasst: 14 Mai 2026, 10:46
Hilfe für Linuxliebhaber und Windowsbenutzer
https://aspweb.ch/forum/
Code: Alles auswählen
http://arduino.esp8266.com/stable/package_esp8266com_index.json
Code: Alles auswählen
const int AOUT_PIN = A0; // Aout direkt an A0
const float ZERO_CURRENT_VOLTAGE = 1.65; // Ruhespannung bei 0A
const float SENSITIVITY = 0.022; // 22mV/A
void setup() {
Serial.begin(115200);
Serial.println("WCS1600 Stromsensor Test");
}
void loop() {
int raw = analogRead(AOUT_PIN);
float voltage = (raw / 1024.0) * 3.3; // ESP8266: 3.3V Referenz
float current = (voltage - ZERO_CURRENT_VOLTAGE) / SENSITIVITY;
Serial.print("Spannung: ");
Serial.print(voltage, 3);
Serial.print(" V | Strom: ");
Serial.print(current, 1);
Serial.println(" A");
delay(500);
}