Go Down

Topic: Python to Arduino via Ethernet Xport (Read 650 times) previous topic - next topic

shazzner

I'm trying to send a simple test message from a python program to my arduino over ethernet. The arduino has an Xport ethernet shield from adafruit. I can't seem to get the arduino to receive the message.

Here is my Python script:
Code: [Select]
       print "sending TCP packets"
       port = 40000
       host = "192.168.1.155"
       s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
       s.connect((host,port))
       s.send('Hello, world')
       #s.sendto("Send complete!", (host,port))
       s.close()


Here is my basic wait function for my arduino:
Code: [Select]
uint16_t requested(void)
{
 uint8_t read, x;
 char *found;
 Serial.print(".");
 while (1) {
   read = xport.readline_timeout(linebuffer, 128, 200);
   //Serial.println(read, DEC);   // debugging output
   if (read == 0)     // nothing read (we timed out)
     return 0;
   if (read)          // we got something!
   {
     Serial.println("Got something!");
     Serial.println(linebuffer);
   }
 }
}
With the Loop running that method every time.

This is what my Xport configuration screen looks like:


I've also tried adjusting the port forwarding settings on my router to forward everything to the arduino.

Anyone who's done something similar I would happy to know how you got it working. Thanks!

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy