-->
Page 2 of 4

thanks for this

PostPosted: Tue Jun 30, 2015 9:23 am
by ofer221
wow (-: its great ,
is it possible to send raw codes ?

Re: IR sender library

PostPosted: Tue Jun 30, 2015 1:45 pm
by danbicks
Well done Torin42,

When will a finished Library be available to implement in to projects?

I can see adding MQTT to this would be really cool.

Idea to control TV or smart box via IR via MQTT.

Keep up the good work mate

Dans

Re: IR sender library

PostPosted: Thu Jul 02, 2015 12:33 pm
by ofer221
hey , I've played with your library a bit , but I have a little problem ,
When I try to run simple sever for sending IR codes, it works grate but I can't restart the module without pulling out the IR transmitter first , otherwise the esp blue led stays on and no connection is made.
Some one had something like this ?

I have esp 8266 - 01
boot version - 1.2
AT version - 0.21.0.0
SDK version - 0.9.5

connections :

VCC - 3.3v ( power sorce )
GND - gnd ( power sorce )
CH-PD - pullup 10k- 3.3v ( power sorce )
GPIO 2 / 0 - IR led - gnd (tried both gpio2 and gpio 0 )

also tried to pull up GPIO 0 with 10 k to 3.3v

and here is the code :


#include <IRremoteESP8266.h>
#include <IRremoteInt.h>
#include <string.h>
#include <ESP8266WiFi.h>
#include <stdlib.h>
IRsend irsend(2);
const char* ssid = "...........";
const char* password = "..............";
WiFiServer server(80);

void setup() {
Serial.begin(115200);
delay(10);
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
server.begin();
Serial.println("Server started");
Serial.println(WiFi.localIP());

irsend.begin();
}

void loop() {
WiFiClient client = server.available();
if (!client) {
return;
}

Serial.println("new client");
while(!client.available()){
delay(1);
}

String req = client.readStringUntil('H');
Serial.println(req);
client.flush();

String req2 = req.substring(5,14);
unsigned long number = req2.toInt();
delay(1);

Serial.println(req2);
Serial.println(number);

irsend.sendNEC(number, 32);
client.flush();
delay (100);
}

Re: IR sender library

PostPosted: Thu Jul 02, 2015 2:20 pm
by martinayotte
Having LEDs on GPIO2 or GPIO0 to GND is equivalent of having them pulled-down. For normal boot, both should be pulled up.
So, the solution is to reverse the LEDs and have them connected to VCC, and in the firmware, simply reverse polarity too : 0 means LED On and 1 means LED Off.