Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "esp_adc_cal.h"
- #include <Arduino.h>
- int BatIntValue = 0; // value read from the
- int TestIntValue = 0; // value read from the
- int Count = 0;
- unsigned long lastTimeCycle = 0;
- unsigned long lastTimeDelay = 1000;
- void setup()
- {
- Serial.begin(115200);
- }
- void loop()
- {
- if ((millis() - lastTimeCycle) > lastTimeDelay) {
- Count++;
- BatIntValue = analogRead(35);
- TestIntValue = analogRead(32);
- Serial.print("ID: ");
- Serial.print(Count);
- Serial.print(" > BAT INT: ");
- Serial.print(BatIntValue);
- Serial.print(" | BAT Berechnet: ");
- Serial.print((BatIntValue * 3.3 / 4095 * 2); // 2x wegen Spannungsteiler
- //Serial.print(BatIntValue * 3.3 / 4095 * 2); // 2x wegen Spannungsteiler
- Serial.print("V | Test INT: ");
- Serial.print(TestIntValue);
- Serial.print(" | Test Berechnet: ");
- Serial.print(TestIntValue * 3.3 / 4095);
- Serial.println(" V");
- lastTimeCycle = millis();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement