Show Posts
|
|
Pages: [1] 2 3
|
|
1
|
Using Arduino / Networking, Protocols, and Devices / remote robot JSON configuration
|
on: February 05, 2013, 04:05:36 am
|
|
Hello,
If someone knows, I wish to get an advice on the remote robot JSON configuration I need to do over TCP/UDP. I did JSON configuration file - easy exemple:
{ "servo1max"=130, "servo1min"=60, "servo1init"=90, "LED1init"=1 }
I send this file to robot to setup several variables. Several setup files are possible for one robot and I choose what I send to robot without any need to upload the code to robot.
Are there already any known standards? that I can get inspiration from or just to use them for my robot? I know about some for permanent online setup and data processing, but I do need now one step initial robot setup remote configuration.
Many thanks, Petr
|
|
|
|
|
2
|
Using Arduino / Programming Questions / Re: Switch / Case with multiple variables?
|
on: September 23, 2012, 03:29:03 pm
|
when I recieve UDP command, I use switch in following way to join several possibilities to one result: if(packetBuffer[0] == 'R' || packetBuffer[0] == 'r') switch_value = 0; //reset if(packetBuffer[0] == 'W' || packetBuffer[0] == 'w') switch_value = 1; //speed up if(packetBuffer[0] == 'S' || packetBuffer[0] == 's') switch_value = 2; //speed down
switch (switch_value) { case 0: servoPos = 90; // tell servo to go to position servoPos servoMove(servoPos); led_blink(); break; case 1: if( servoPos >= 10 && servoPos <= 165) { servoPos = servoPos+5; // tell servo to go to position servoPos servoMove(servoPos); } led_blink(); break; case 2: if( servoPos >= 15 && servoPos <= 165) { servoPos = servoPos-5; // tell servo to go to position servoPos servoMove(servoPos); } led_blink(); break; default: // if nothing else matches, do the default // default is optional
|
|
|
|
|
3
|
Using Arduino / Programming Questions / WiShield UDP
|
on: June 20, 2011, 03:45:49 am
|
Hello, at present. I wish to switch from Ethernet shield (EtSh) to Wishield. I use UDP connection on the EtSh and it's functions provided by udp.h library. What are equivalent functions for wishield? ie: ethernet functions: Udp.readPacket( packetBuffer,UDP_TX_PACKET_MAX_SIZE, IP, Port); Udp.sendPacket( packetBuffer, IP, Port); What are wishield equivalent functions? The UDPapp has only wifi.run() and I didn't find answer. Need to correct this for wishield : void loop() { WiFi.run(); int packetSize = Udp.available(); if(packetSize) { Udp.readPacket( packetBuffer,UDP_TX_PACKET_MAX_SIZE, IP, Port); //EtSh function for(int i=0;i<4;i++) Serial.print( IP[i]); Serial.println(); Serial.println( Port); Serial.println( packetBuffer); Udp.sendPacket( packetBuffer, IP, Port); //EtSh function } }
Thank you! Peter
|
|
|
|
|
5
|
Using Arduino / Programming Questions / Re: getRequest to a server
|
on: June 08, 2011, 12:16:21 am
|
|
OK, it is good news it is working on your arduino. Now the prblm is on my SW/HW side then.
Can you please confirm/sudgest: I use arduino 22 and library inside, ethernet shield, I connect to router
Thanks, Peter
|
|
|
|
|
6
|
Using Arduino / Programming Questions / Re: getRequest to a server
|
on: June 07, 2011, 04:34:21 pm
|
of course... #include <SPI.h> #include <Ethernet.h> byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; byte ip[] = { 192,168,1,178 }; byte server[] = { 88, 146, 119, 160 }; // soupis.cz Client client(server, 80);
void setup() { Ethernet.begin(mac, ip); Serial.begin(19200); delay(500); Serial.println("connecting..."); if (client.connect()) { Serial.println("connected"); client.print("GET /data/DEMO_MODE/system/phpCommunication/?mode=5&user=test&pass=test HTTP/1.1\n\r"); client.print("Host: soupis.cz\n\r"); client.print("Connection: close\n\r"); client.print("\n\r"); } else { Serial.println("connection failed"); } }
void loop() { if (client.available()) { char c = client.read(); Serial.print(c); } if (!client.connected()) { Serial.println(); Serial.println("disconnecting."); client.stop(); for(;;) ; } }
|
|
|
|
|
7
|
Using Arduino / Programming Questions / Re: getRequest to a server
|
on: June 07, 2011, 03:32:53 pm
|
maniacbug: I formulated the request, but have got the answer herebellow. Mabye shal I use another HTML than 1.0 or 1.1 ? How to ask server what does it accepts? HTTP/1.1 400 Bad Request Date: Tue, 07 Jun 2011 20:29:48 GMT Server: Apache Content-Length: 285 Connection: close Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>400 Bad Request</title> </head><body> <h1>Bad Request</h1> <p>Your browser sent a request that this server could not understand.<br /> </p> <hr> <address>Apache Server at parkovani Port 80</address> </body></html>
|
|
|
|
|
9
|
Using Arduino / Programming Questions / Re: getRequest to a server
|
on: June 07, 2011, 01:55:42 pm
|
Thank you friends for your sudgestions. Unfortunately I am missing something, because I get answer with following header: [size=6pt]HTTP/1.1 301 Moved Permanently Date: Tue, 07 Jun 2011 18:54:00 GMT Server: Apache Location: http://parkovani/?mode=5&user=test&pass=test Cache-Control: max-age=7200 Expires: Tue, 07 Jun 2011 20:54:00 GMT Content-Length: 319 Connection: close Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="http://parkovani/?mode=5&user=test&pass=test">here</a>.</p> <hr> <address>Apache Server at parkovani Port 80</address> </body></html>[/size]
Here is the code: #include <SPI.h> #include <Ethernet.h> byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; byte ip[] = { 192,168,1,178 }; byte server[] = { 88, 146, 119, 160 }; // soupis.cz Client client(server, 80);
void setup() { Ethernet.begin(mac, ip); Serial.begin(19200); if (client.connect()) { Serial.println("connected"); client.print("GET /data/DEMO_MODE/system/phpCommunication/?mode=5&user=test&pass=test HTTP/1.0\n\r\n\r"); } else { Serial.println("connection failed"); } }
void loop() { if (client.available()) { char c = client.read(); Serial.print(c); } if (!client.connected()) { Serial.println(); Serial.println("disconnecting."); client.stop(); for(;;) ; } }
|
|
|
|
|