BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

NodeMcu ESP8266 Wifi IR Blaster does not work

esp8266
#1

Hey,

when I want to send the hexadecimal code from the IR-Led to my LED-Strip, the only thing that happens is that the IR-Led just turns on when I press the Button in the app but does not send the code to the LED-Strip. My LED is working just fine. Tested it and the code several times and had no issues when I was not using the app. The IR-Led is hooked to D2 and the other pin to GND. My guess is that somehow the app just send the command for the digital pin to go High, so it will just turn on but not send a signal. Here is my code:

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <Arduino.h>
#define BLYNK_PRINT Serial
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "";

const uint16_t kIrLed = 4;

IRsend irsend(kIrLed);
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "";
char pass[] = "";

BlynkTimer timer;

// This function sends Arduino’s up time every second to Virtual Pin (5).
// In the app, Widget’s reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
{
// You can send any value at any time.
// Please don’t send more that 10 values per second.
Blynk.virtualWrite(V1, millis() / 1000);
}

void setup()
{
  Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
  Blynk.begin(auth, ssid, pass);
  irsend.begin();
  timer.setInterval(1000L, myTimerEvent);
}
BLYNK_WRITE(V1){

int onoff = param.asInt();
if(onoff == 1){
irsend.sendNEC(0xF7C03F, 32);
}
}

void loop(){
  Blynk.run();
  timer.run();
}

I hope someone has an idea of what I have made wrong. Thanks for your help in advance :slight_smile:

0 Likes

#2

What happens if you change your timer interval to 60000 instead of 1000?

In the app, how is your button widget configured?

Pete.

0 Likes

#3

Hey Pete,

thanks for your fast reply. Setting the interval to 60000 did not work and lowering it to 100 did also not work. Button Settings in the app are: Output D2 0 to 1 when pressed 1 to 0 when pressed again and the Button is in Switch Mode (Did try the Push Mode but it didnt work). Did also already try if(onoff == HIGH) but it didnt work either.

0 Likes

#4

Well your code is expecting the button to be connected to virtual pin V1

Pete.

0 Likes

#5

It worked for me thanks :smiley: Applied V1 as the Output in the app and it works just fine. Thank you for your help in this case Pete :slight_smile:

1 Like

#6

Glad your project works!

But, :point_up: learn to format your code on forums properly. It will be easier then for people to help you.

Continuing the discussion from [README] Welcome to Blynk Community!:

1 Like