Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------
- For the UNO
- ----------------------
- int input = 13;
- bool status;
- void setup()
- {
- pinMode(input, INPUT);
- Serial.begin(9600);
- }
- void loop(){
- if(digitalRead(input) == HIGH){
- status = true;
- }
- if(digitalRead(input) == LOW){
- status = false;
- }
- Serial.println(status);
- }
- ----------------------
- For the ESP
- ----------------------
- int outputPin = 10;
- void setup(){
- pinMode(outputPin, OUTPUT);
- }
- //other code yadda yadda
- void turnOn(String deviceId){
- if(deviceID == DEVICE1){
- digitalWrite(outputPin, HIGH);
- }
- }
- void turnOff(String deviceId){
- if(deviceID == DEVICE1){
- digitalWrite(outputPin, LOW);
- }
- }
- //now making an LED turn on and off with digitalWrite will work fine. So the yadda yadda code works. Its just when to turn the "device" on or off to carry out the HIGH and LOW will not pass and gives HIGH/LOW constantly
Add Comment
Please, Sign In to add comment