Created
May 28, 2020 07:11
-
-
Save EDISON-SCIENCE-CORNER/19c4c83dfeb68313f2d9c9f8b2e41a47 to your computer and use it in GitHub Desktop.
This file contains 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
// 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