Last active
November 10, 2023 04:18
-
-
Save kakopappa/580e05d98109e36f6b4ace84bded1c7b to your computer and use it in GitHub Desktop.
Complete tutorial : https://help.sinric.pro/pages/tutorials/custom-device-types/alcohol-sensor/MQ-3.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if defined(ESP8266) | |
const int adcPin = A0; | |
#elif defined(ESP32) | |
const int adcPin = 34; | |
#elif defined(ARDUINO_ARCH_RP2040) | |
const int adcPin = 26; | |
#endif | |
int sensorVal; | |
void setup() { | |
Serial.begin(9600); | |
Serial.println("warming up for 20 seconds ..!"); | |
delay(20000); | |
} | |
void loop() { | |
sensorVal = analogRead(adcPin); | |
Serial.printf("value: %d\r\n", sensorVal); | |
delay(2000); // delay 2s | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment