Loading...
  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:

Code:
    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 :

Code:
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
4  Using Arduino / Programming Questions / Re: getRequest to a server on: June 08, 2011, 04:37:24 pm
Thanks, the code works now. Thank you!
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...

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);
  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?

Code:
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>
8  Using Arduino / Programming Questions / Re: getRequest to a server on: June 07, 2011, 03:28:43 pm
PaulS: what happens with directories? ... it is not working
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:

Code:
[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&amp;user=test&amp;pass=test">here</a>.</p>
<hr>
<address>Apache Server at parkovani Port 80</address>
</body></html>[/size]

Here is the code:

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(;;)
      ;
  }
}
10  Using Arduino / Programming Questions / Re: getRequest to a server on: June 07, 2011, 05:43:31 am
just click on the link http://myserver.com/data/DEMO_MODE/system/phpCommunication/?mode=5&user=test&pass=test [/url] and you get what I need to read. Nothing more is sent as an answer...
11  Using Arduino / Programming Questions / Re: getRequest to a server on: June 07, 2011, 04:53:34 am
I know this code. Unfotunately it is not the code I hope to get.

I did this:

...
byte server[] = { 87, 156, 219, 170 }; => this is set as IP for myserver.com
...
client.println("http://myserver.com/data/DEMO_MODE/system/phpCommunication/?mode=5&user=test&pass=test");
...

char c = client.read();
...

but the server don't send "1" nor "0", but answers with a whole page it doesn't understands the request. The request works using the ordinary browser. What do you think?
12  Using Arduino / Programming Questions / getRequest to a server on: June 06, 2011, 02:17:56 pm
hello,

I am trying to solve how to make a getRequest to a server using only the http ie:

I ask: "http://www.myserver.com/?mode=1&user=username&pass=sometext"
server send: "1"

I need to save the resuld received into a variable like in Processing ie:

String answer = something("http://www.myserver.com/?mode=1&user=username&pass=sometext");

I am not able to find any solution. Can someone help?

Thenk you,
Petr
13  Using Arduino / Programming Questions / how to save "http request" answer on: June 06, 2011, 07:31:11 am
Hello,

I need help with task I didn't found solution for:

> getRequest and arduino: I have a server that return a value "1", or "0" or a "some text" as a response to the following getRequest:

"http://domaineX.com/system_phpCommunication/?mode=1&user=james&pass=1234&unit=unit_one"
"http://domaineY.com/system_phpCommunication/?mode=3&user=sertioc&pass=1234&unit=unit_h"

How to save the answer into a String variable on arduino like:

String answerX = function("http://domaineX.com/system_phpCommunication/?mode=1&user=james&pass=1234&unit=unit_one");
String answerY = function("http://domaineY.com/system_phpCommunication/?mode=3&user=sertioc&pass=1234&unit=unit_h");

where answerX and answerY can contains ie: "1", or "0" or a "some text"

many thanks!
Peter
14  Forum 2005-2010 (read only) / Troubleshooting / Re: Program stops on: October 19, 2010, 12:25:26 am
One more question: Is there a possibility to look at the memory size used by my programm to see separately Flash, SRAM and EEPROM?
15  Forum 2005-2010 (read only) / Troubleshooting / Re: Program stops on: October 18, 2010, 05:03:14 am
Thank you, its up to me to learn now :-)
Pages: [1] 2 3