Salve a tutti, provengo da arduino duemilanove.
Avevo creato un socket con questo codice...
Collegamento arduino yun con usb e collegato anche l'ethernet.
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address, IP address and Portnumber for your Server below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress serverIP(192,168,1,13);
int serverPort=8888;
// Initialize the Ethernet server library
// with the IP address and port you want to use
EthernetServer server(serverPort);
void setup()
{
// start the serial for debugging
Serial.begin(9600);
// start the Ethernet connection and the server:
Ethernet.begin(mac, serverIP);
server.begin();
Serial.println("Server started");//log
}
void loop()
{
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
String clientMsg ="";
while (client.connected()) {
if (client.available()) {
char c = client.read();
//Serial.print(c);
clientMsg+=c;//store the recieved chracters in a string
//if the character is an "end of line" the whole message is recieved
if (c == '\n') {
Serial.println("Message from Client:"+clientMsg);//print it to the serial
client.println("You said:"+clientMsg);//modify the string and send it back
clientMsg="";
}
}
}
// give the Client time to receive the data
delay(1);
// close the connection:
client.stop();
}
}
ma caricandolo su arduino yun non va...di compilare compila, però mi dice impossibile connettersi... forse stai usando un bridge??!??!
che significa..?!?!
Io voglio inviare una stringa da un programmino fatto in java. Su arduino duemilanove va una bomba!
grazie