Webpage controlled robot project. Need help

Hey all,

Im new to the forum, and I have a pretty good understanding of the basic arduino projects. I am trying to take it to the next step with controlling my robot from a webpage. The robot has 8 servos that i want to be able to control from my uno. The arduino can be plugged in to computer via usb for the internet connection.

What i'm trying to do is have a webpage that I create be able to command the robot. Im trying to have it so when I click a button on the website, it sends a number 'xxxx' to the arduino and then the arduino interprets the number to do a action. I am trying to follow an example where they use processing to communicate with a google apps script gadget. then then put the google apps script gadget onto their google site page. Its going over my head and I am having trouble following it. I was wondering if anyone could help me with this process.

Also is there a way that when the arduino reads a variable say: '1234' Is there a way to have it split it up to assign it? like have x = 12, the first two numbers y=3, and z=4? Another example would be it reading '5678' and setting x=56 y=7 and z=8.

I may not be doing any of this right haha.
Any help or advice would be greatly appreciated.

Thanks!

If the web page is dynamically created by php or asp.net or JavaScript, what you want to do might be possible. The processing of the items on the web page (buttons, text entry fields, etc.) needs to happen in an application that also knows how to write to the serial port.

That's a relatively inefficient way to do it, though. A real application on the PC would be better.

Also is there a way that when the arduino reads a variable say: '1234' Is there a way to have it split it up to assign it? like have x = 12, the first two numbers y=3, and z=4?

The Arduino will read all the data available on the serial port. You need some way to tell it to keep reading until it has come to the end of a packet. While the fact that there are 4 bytes in a packet may seem appealing, serial data can, and does, get corrupt, and discarded. Then, you get three character from one packet and 1 from the next. That's obviously not correct, or good.

So, make the sender send an end-of-packet marker (carriage return works well), and read and store data until the end of packet marker arrives.

Decoding the data the way you propose then would be trivial.

Bitlash Commander might be suitable for your application. It runs on the PC and serves web control panels that talk to the Arduino.

-br

hmmmm I think i'm in over my head :expressionless:

This is the code they used in the example with google apps web script

 //this code is part of a tutorial to show the
//potential to interface google apps script with
//the arduino microcontroller
//written by Kyle Brinkerhoff

var serialdoc ="Untitled document"; //this variable is the unique file id for the file saved in google docs.

function doGet() {   // this function is the setup function that calls the UI into existence
var app = UiApp.createApplication();
app.add(app.loadComponent("remote"));//load the ui named "remote"
      return app;
}
//these functions write to the file that stores the command for the desktop application to download and send to the serial port
function ON(){
DocsList.getFileById(serialdoc).replace("1");// write the command to the file to turn the 13pin on
 
}

function OFF(){

  var comclear=DocsList.getFileById(serialdoc).replace("0");// write the command to the file to turn the 13pin off

}