Skip to content

Commit

Permalink
Added port input by user + fixed welcome message
Browse files Browse the repository at this point in the history
  • Loading branch information
DrBit committed Feb 22, 2012
1 parent 1164ba8 commit 1ada599
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
6 changes: 5 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
*********************************************
** REVISIONS from:
**
** V0.1 - 02/16/2012
** V0.2 - 22/02/2012
** * Fixed example command as welcome message
** * Port input inplemented
**
** V0.1 - 16/02/2012
** * Created simple client
** * Reads and writes to a server chosen at the begining of the sketch
28 changes: 14 additions & 14 deletions tcptest.pde
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
/*
Web client
This sketch connects to a website (http://www.google.com)
using an Arduino Wiznet Ethernet shield.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
created 18 Dec 2009
by David A. Mellis
Seed conter tests
*/

Expand Down Expand Up @@ -47,8 +38,10 @@ void setup() {
Serial.println("");

Serial.print ("Type server ip: ");

receive_printer_IP ();

Serial.print ("Type server port: ");
receive_printer_PORT ();

connection_alive = connect_to_client ();

Expand Down Expand Up @@ -101,7 +94,7 @@ boolean connect_to_client () {
// if you get a connection, report back via serial:
if (client.connect(server, port)) {
Serial.println("connected!");
print_to_server ("Hello Server/nThis is an example of command/nC1");
print_to_server ("Hello Server\nThis is an example of command:\nC1");
return true;
} else {
// kf you didn't get a connection to the server:
Expand All @@ -111,7 +104,7 @@ boolean connect_to_client () {

}

print_to_server (char text) {
void print_to_server (char* text) {
client.println(text);
Serial.println(text);
}
Expand Down Expand Up @@ -190,8 +183,15 @@ void receive_printer_IP () {


Serial.println (ip_to_str(server));
}


void receive_printer_PORT () {
const int buf_port = 6;
char printerPort[buf_port];
recevie_data (printerPort,buf_port);
char * thisChar = printerPort;
port = atoi(thisChar);
Serial.println (port);
}


Expand Down

0 comments on commit 1ada599

Please sign in to comment.