Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EDISON-SCIENCE-CORNER/19c4c83dfeb68313f2d9c9f8b2e41a47 to your computer and use it in GitHub Desktop.
Save EDISON-SCIENCE-CORNER/19c4c83dfeb68313f2d9c9f8b2e41a47 to your computer and use it in GitHub Desktop.
// www.edisonsciencecorner.blogspot.com
// https://www.youtube.com/channel/UCESZHuYTzx0Eyd3yJ8u60Fg
#include <ESP8266WiFi.h>
char ssid[] = "edison science corner"; // ssid
char pass[] = "eeeeeeee"; // password
int readD1;
int readD2;
int Pin_D1 = 4;
int Pin_D2 = 5;
void setup() {
Serial.begin(9600);
pinMode(Pin_D1, OUTPUT);
pinMode(Pin_D2, OUTPUT);
}
int analogRead1() {
digitalWrite(Pin_D1, HIGH); // Turn D1 On
digitalWrite(Pin_D2, LOW); // Turn D2 Off
return analogRead(0);
}
int analogRead2() {
digitalWrite(Pin_D1, LOW); // Turn D1 On
digitalWrite(Pin_D2, HIGH); // Turn D2 Off
return analogRead(0);
}
void loop() {
readD1 = analogRead1(); // Read Analog value of first sensor
delay(200);
readD2 = analogRead2(); // Read Analog value of second sensor
delay(200);
Serial.print("sensor 1 = ");
Serial.print(readD1);
Serial.print(" / sensor 2 = ");
Serial.println(readD2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment