Using Photon to Send IR with a HTTP server

Hi,

Could someone help me make a program that sends ir signal from a Photon using an onboard http server or via serial.

I would like to use Pronto IR code.

Thank you.

It always helps to show what you’ve tried so far :wink:

1 Like

I havent made a anything yet :worried:
Ive tried to learn some by reading this Photon: Sending Infrared remote control signals

I managed to connect to the photon with Telnet with an example code i found somewhere. Problem is I dont know how and where to add the “ir code”

I need a minimum of 2 different ir codes to send.

if i send A then ir signal 1
and if i send B then ir signal 2

TCPServer server = TCPServer(23);
TCPClient client;

char addr[16];

char incoming;

void setup()
{

   pinMode(D7, OUTPUT);
   digitalWrite(D7, HIGH); 
   delay(1000);
   digitalWrite(D7, LOW); 
   delay(1000); 
   delay(1000);
   delay(1000);  // give a few seconds to reflash the core if it gets unresponsive on startup
   digitalWrite(D7, HIGH); 
   delay(1000);
   digitalWrite(D7, LOW); 


  server.begin();
  IPAddress localIP = WiFi.localIP();
  sprintf(addr, "%u.%u.%u.%u", localIP[0], localIP[1], localIP[2], localIP[3]);
  Spark.variable("Address", addr, STRING);
}

void loop()
{
  client = server.available();
   if (client.connected()) {
    client.println("Connected to Spark!");
    client.println(WiFi.localIP());
    client.println(WiFi.subnetMask());
    client.println(WiFi.gatewayIP());
    client.println(WiFi.SSID());
    client.println(">");

    while (client.connected()) {
      while (client.available()) {

        incoming = client.read();
        client.write(incoming);  // great to show on telnet what has been printed
        if (incoming == 'A'){   digitalWrite(D7, HIGH); }
        if (incoming == 'B'){   digitalWrite(D7, LOW); }
      }
    }
  }
}
1 Like

Have you got the IR signals you want to send already digitalized?
What IR transmitter are you intending to use?

In the thread you linked above you’d find a link to another thread featuring a uPWM hack by @AnalysIR
http://www.analysir.com/blog/2015/10/02/backdoor-upwm-hack-on-photon-for-infrared-signals-using-uart/

Have a look at his code