/**************************************** * TGS8100 sensor Arduino Uno *****************************************/ int adval = 0; //ADC data float sensor_r; void setup() { Serial.begin(115200); pinMode(A0, OUTPUT); //PULSE pin } void loop() { digitalWrite(A0, HIGH); //PULSE pin HIGH delay(1); //Wait until OUT stabilizes adval = analogRead(A1); //ADC delay(1); // digitalWrite(A0, LOW); //PULSE pin HIGH if (adval != 0) { //((3.0 / (adval * 5.0 / 1024.0)) - 1)*10k ohm sensor_r = 6144.0 / adval - 10; Serial.println(sensor_r, 1); } else Serial.println("div 0 "); delay(998); // }