You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I put an ethernet shield on an arduino uno. also no connection with my node.js socket.io server, I used also your app.js and the older socket implementation.
is there a way to debug the conncetion on the arduino?
I can send udp, read http with the ethernet shield. any ideas? would be realy great to get help.
regards
#define W5100
#include "SocketIOClient.h"
#include "Ethernet.h"
#include "SPI.h"
SocketIOClient client;
byte mac[] = { 0xDE, 0xAA, 0xBB, 0xEF, 0xFE, 0xED };
char hostname[] = "192.168.1.56";
int port = 4444;
extern String RID;
extern String Rname;
extern String Rcontent;
unsigned long previousMillis = 0;
long interval = 10000;
void setup() {
// pinMode(10, OUTPUT); //for some ethernet shield on the mega : disables the SD and enables the W5100
// digitalWrite(10, LOW);
// pinMode(4, OUTPUT);
// digitalWrite(4, HIGH);
Serial.begin(9600);
delay(100);
Ethernet.init(10); // ???
Ethernet.begin(mac);
// Check for Ethernet hardware present
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
Serial.println("Ethernet shield was not found. Sorry, can't run without hardware. :(");
while (true) {
Serial.println("Ethernet shield found :(");
delay(1); // do nothing, no point running without Ethernet hardware
}
}
if (Ethernet.linkStatus() == LinkOFF) {
Serial.println("Ethernet cable is not connected.");
} else {
Serial.println("Ethernet linkStatus ok ");
}
delay(1000);
while (!client.connect(hostname, port)) {
Serial.println(F("Not connected.") );
if (client.connected()) {
client.send("connection", "message", "Connected !!!!");
} else {
Serial.println("Connection Error");
// while(1);
}
delay(1000);
}
delay(1000);
if (client.connect(hostname, port))
Serial.println(F("connected."));
}
void loop() {
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval) {
previousMillis = currentMillis;
Serial.println(F("Interval"));
//client.heartbeat(0);
client.send("atime", "message", "Time please?");
}
if (client.monitor()) {
Serial.println(RID);
if (RID == "atime" && Rname == "time") {
Serial.print("Time is ");
Serial.println(Rcontent);
}
}
}
The text was updated successfully, but these errors were encountered:
I put an ethernet shield on an arduino uno. also no connection with my node.js socket.io server, I used also your app.js and the older socket implementation.
is there a way to debug the conncetion on the arduino?
I can send udp, read http with the ethernet shield. any ideas? would be realy great to get help.
regards
The text was updated successfully, but these errors were encountered: