Dual activation

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:

void loop() {
  if (val == HIGH){
  else {


How can I do that?


Hi, please avoid delay in main loop it may cause issues. See for instance this example

What? I think you understood me wrong. I dont wanna put data in blynk. I want to activate a led with blynk and a sensor. When I put this in the same code, sensor doesn’t work

The problem with delay() is that it is most likely to interrupt the Blynk connection. The sketch Dmitriy posted, i think was to show the use of timer library instead of delay()

I think (haven’t tried) but in this case you should also be able to use the concept from the standard arduino sketch “blinkWithoutDelay” where you read the millis() instead of using delay.

Hope it helps :slight_smile: