Hello guys. I was trying something, but isn’t work.
My ideas is activate the led with the touch sensor OR pressing a button in blynk. I can do both separate, but when I try include them in the same project, doesn’t work. Here’s the code:
int led = 8;
int sensor=7;
int val;
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <SimpleTimer.h>
#include <BlynkEthernet.h>
char auth[] = "xxxxxxxxxxxxx";
void setup() {
pinMode(led,OUTPUT);// put your setup code here, to run once:
pinMode(sensor,INPUT);
Blynk.begin(auth);
}
void loop() {
Blynk.run();
val=digitalRead(sensor);
if (val == HIGH){
digitalWrite(led,HIGH);
delay(1000);
}
else {
digitalWrite(led,LOW);}
}
How can I do that?