Skip to content
Browse files

Added port input by user + fixed welcome message

  • Loading branch information...
1 parent 1164ba8 commit 1ada599103d0dbe274bcf076875a4d07bbd7868b @DrBit committed Feb 22, 2012
Showing with 19 additions and 15 deletions.
  1. +5 −1 README
  2. +14 −14 tcptest.pde
View
6 README
@@ -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
View
28 tcptest.pde
@@ -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
*/
@@ -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 ();
@@ -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:
@@ -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);
}
@@ -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);
}

0 comments on commit 1ada599

Please sign in to comment.
Something went wrong with that request. Please try again.