maybe try removing "IRQ" connection? as its not needed.
also i had the some issues, but i had my wires mixed up..
Follow this Tut:
https://www.mysensors.org/build/connect_radio
maybe try removing "IRQ" connection? as its not needed.
also i had the some issues, but i had my wires mixed up..
Follow this Tut:
https://www.mysensors.org/build/connect_radio
Hi mfalkvidd,
Thank you for the quick reply, appreciated the help.
Arduino Uno3 with a generic ethernet shield on it, which i picked up at local computer store. I have the Arduino powered via a 5V 2A (2000mA) switching power supply which connects directly to wall outlet.
I dont have the serial connected. As you know, i wanted the device to power via wall outlet. So I dont need to connect the USB Serial. But you are right, this would be a good step to troubleshoot issues. However i didnt want my computer plugged in for long time, as i have other projects im working on
But i can connect Serial and watch output. The only issues it i think it takes few hours before Arduino becomes unresponsive.
Hello all,
Im having some issues with my code. It works great, but only for a few hours. Then device disconnects/unresponsive. Hope someone can give me some advice on my code. I created this device to control my TV. Thank you in advanced and appreciated any advice.
#include <IRremote.h>
#include <IRremoteInt.h>
#include <SPI.h>
#include <UIPEthernet.h>
#include <PubSubClient.h>
IRsend irsend;
int irledPin = 3;
int ledPin = 5;
// Current input
int currentimput = 1;
// mgmt number
int currentmgmtping = 0;
// Settings for "Status of Device"
byte bytebuffer[30];
// Update these with values suitable for your network.
byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
IPAddress ip(192, 168, 1, 201);
IPAddress server(192, 168, 1, 200);
//
// Callback function header
//
void callback(char* topic, byte* payload, unsigned int length);
//
// toString function header
//
String toString(byte* payload, unsigned int length);
EthernetClient ethClient;
PubSubClient client(ethClient);
void reconnect() {
// Loop until we're reconnected
while (!client.connected()) {
Serial.print("Attempting MQTT connection...");
// Attempt to connect
if (client.connect("arduinoClient")) {
Serial.println("connected");
// Once connected, publish an announcement...
client.publish("/home/master/tv","Connected");
// ... and resubscribe
client.subscribe("/home/master/tv");
} else {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" try again in 5 seconds");
// Wait 5 seconds before retrying
delay(5000);
}
}
}
void lightled(){
digitalWrite(5, HIGH);
delay(1000);
digitalWrite(5, LOW);
}
// Setup Stuff ~~~~~~~~~~
void setup(){
Serial.begin(9600);
delay(500);//Delay to let system boot
Serial.println("Master rooms TV remote\n\n");
delay(1000);//Wait before accessing Sensor
//MQTT Connect
client.setServer(server, 1883);
client.setCallback(callback);
Ethernet.begin(mac, ip);
// Allow the hardware to sort itself out
delay(1500);
// initialize the pushbutton pin as an input:
pinMode(irledPin, OUTPUT);
pinMode(ledPin, OUTPUT);
} //END Setup
//Loop Stuff ~~~~~~~
void loop() {
if (!client.connected()) {
reconnect();
}
client.loop();
} //END Loop
//
// MQTT Callback function
//
void callback(char* topic, byte* payload, unsigned int length) {
if (strcmp(topic, "/home/master/tv") == 0) {
String msg = toString(payload, length);
//
// Send TV IR code
//
Serial.println("Received Message MSG sending Code");
if (msg=="POWER"){
irsend.sendNEC(0x20DF10EF, 32); // TV power code
lightled();
} else{
// Do nothing
}
}
}
//
// toString function
//
String toString(byte* payload, unsigned int length) {
int i = 0;
char buff[length + 1];
for (i = 0; i < length; i++) {
buff[i] = payload[i];
}
buff[i] = '\0';
String msg = String(buff);
return msg;
}