I havent made a anything yet
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); }
}
}
}
}