Go Down

Topic: Input vulue into string  (Read 32 times) previous topic - next topic

mtete

May 03, 2016, 04:01 pm Last Edit: May 03, 2016, 04:07 pm by mtete
Hello,

I dont think the topicname is a good one, but I cant think a better one.

I can rotate a Dynamixel through ethernet with the ethernet shield.
Now I want to change the speed, position and PID values through ethernet.

I think it can work by:

Code: [Select]
Example speed
Speed Value -> input field -> into string -> StrContains(HTTP_req, "Speed-value") -> read string speed-value convert to int value ->
Dynamixel.servo(SERVO_ID,0x3FF,speed_val); // Dynamixel go to IN-position


I rewrite the code this Ethernet tutorial: https://startingelectronics.org/tutorials/arduino/ethernet-shield-web-server-tutorial/SD-card-IO/


I tried:
Save input values into string and than read them in the arduino sketch with:
Code: [Select]
if (StrContains(HTTP_req, "speed")) {
speed1 = StrContains(HTTP_req, "speed")
 Dynamixel.servo(SERVO_ID,0x3FF,speed1);
}

Without any luck.
Does someone know a way to put those values into the StrContains(HTTP_req, "speed") string and read the value into the arduino sketch?

Thanks in advance.

PaulS

Quote
Does someone know a way to put those values into the StrContains(HTTP_req, "speed") string and read the value into the arduino sketch?
The StrContains() function determines if a string contains some substring. You would want to make sure that the string in HTTP_req contained the substring "speed". The return value from the call is 0 if the string is not found, and 1 if it is.

Using the return value as the speed is incorrect.

The HTTP_req string is populated from the GET request, which contains name=value pairs for each named item on the form. So, you need something on the form named speed. The value (in the text field?) will be taken from the form item.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy