Xport - Online Control using a Button

Picked up an Xport Shield from ladyada. I'd like to be able to go to the webserver and be able to have two buttons. On and Off. When I click on, an led goes on. When I click off, the LED goes off. I've seen ladyada's tutorials (and I'm trying to modify them) as well as a few others but they haven't helped too much :-/ Anyone know some quick code that will accomplish this?

Thanks.

Update: I figured out how to flash the xport with a cob file. I found a good tutorial here that is frustrating, but the CMD commands work. Now…How the heck do I tell the Arduino to go out to the webpage and check if something has been altered…?

Any help is much appreciated.

Thanks.

Nobody knows how to do this?

I had some code to toggle an output with a button somewhere. I'll try and dig it up to get you started, but it will probably be tomorrow before I get a chance.

Great, anything would help. There is basically no good documentation on this.

Okay…is anyone else going to help? Anything is appreciated. Thanks.

Here is the code I have based mostly on ladyada's example. Currently it is just a couple of drop downs to set digital outputs. In the future I plan to update the digital output status.

Code

Fantastic! Thank you! :)

You're welcome! Please let us know how it goes.

Going well so far, having a bit of difficulty modifying it to control 3 digital pins instead of just 9 and 10. I tried adding another

var x=document.getElementById(\"digOut11\");txt=txt + x.selectedIndex

and also modifed this:

#define outputCount 3
int digPin[] = {9, 10, 11};
int digVal[outputCount];
char digSelected[3];

I wasn’t too sure about changing digSelected from 2 to 3. Any help would be great.

Thank you.

Yeah, I’m planning to make it auto update in the future, for now you will have to add manually. You were close, I think you just need to add this line to form:

Digital Output 11: <select id=\"digOut11\">  <option>0</option>  <option>1</option></select>

I did add that line actually. it would spit out 001 or 101 or whatever I had it set to. Then when I clicked submit it would either do nothing or light up pin 9 or 10...Maybe I wired it wrong somehow.

Was I correct to change the digSelected from 2 to 3 as well?

Thanks for your help.

The digSelected is not yet used, so that should not have made a difference. I went ahead and made the changes to add output 11 and tested it with an LED on each pin and it worked for me. I updated my software at the same link I posted if you want to download it and compare it to yours. I think I spotted your problem though.

You posted:

var x=document.getElementById(\"digOut11\");txt=txt + x.selectedIndex

But should have done this:

txt=txt + x.selectedIndex;var x=document.getElementById(\"digOut11\");

Ahh…ic. Thanks again Digger, I appreciate your help! :slight_smile:

Quick question: Why did ladyada change the TX, RX, etc. pins in her code?

#define XPORT_RX        2
#define XPORT_TX        3
#define XPORT_RESET     4
#define XPORT_CTS       6

Why not use the actual TX RX pins of the atmel (pins 0 and 1 )?

Thanks.

Pins 0 and 1 are still being used to talk to the computer. This sketch is using software serial on pins 2 and 3 to talk to the Xport module. The only real advantage is being able to send debug messages back to the serial monitor.

Okay, thanks.