HELP:Convert Serial to TCP&send frm Arduino to PC
hi,
does here knows how convert serial tcp packet?
i'm having problem convert serial data tcp packet & send arduino pc. managed convert udp serial , serial udp packet, able convert tcp serial, have no luck converting serial tcp packet.
if knows matter, appreciated if lend me help. i'm using duemilanove , ethernet shield.
i posted source code easier reference.
does here knows how convert serial tcp packet?
i'm having problem convert serial data tcp packet & send arduino pc. managed convert udp serial , serial udp packet, able convert tcp serial, have no luck converting serial tcp packet.
if knows matter, appreciated if lend me help. i'm using duemilanove , ethernet shield.
i posted source code easier reference.
code: [select]
#include <ethernet.h>
byte mac[] = { 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xde }; //arduino rx mac address
byte ip[] = { 192, 168, 1, 175 }; //arduino rx ip address
byte gw[] = { 192, 168, 1, 252 }; //default gateway
byte subnet[] = { 255, 255, 255, 0 };
byte targetip[] = { 192, 168, 1, 65 }; //pc's ip address
#define max_size 100
client client(targetip,8000);
int incomingbyte = 0; // incoming serial data
void setup()
{
ethernet.begin(mac, ip, gw, subnet);
serial.begin(38400); // opens serial port, sets data rate 38400 bps
client.connect(); //connect specified ip , port
}
void loop()
{
if(serial.available() > 0) {
// read incoming byte:
incomingbyte = serial.read();
//client.connect();
//delay(10);
if(client.connected()) {
client.write((uint8_t *)&incomingbyte,max_size); //send tcp packet targetip
}
}
if (client.available()) {
char c = client.read();
}
if (!client.connected()) {
client.stop();
for(;;)
;
}
}
have through sight.
http://www.sparkfun.com/commerce/product_info.php?products_id=9026
you may find there can you, sample code.

http://www.sparkfun.com/commerce/product_info.php?products_id=9026
you may find there can you, sample code.

Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > HELP:Convert Serial to TCP&send frm Arduino to PC
arduino
Comments
Post a Comment