Sketch/Application requests

Discussion about any of the included sketches (i.e. WebServer), or user-generated applications.

Re: Sketch/Application requests

Postby booboobooboo » Sun Jul 19, 2009 3:00 am

Thanks for the vote Comperem!
I thought id also add that, the documentation is slim to none at the moment so having some sketch level functions would save alot of people alot of time scratching their heads. Parsing is something i just cant do a) im not really a coder b) i dont understand the comms process for HTTP (i.e. what am i parsing?), and im gutted that im going to have to put my shield in a drawer now and wait for someone to simplify. I could cry :(

BTW: is there anyway to bind the server onto a port that isnt 80? or listen on a range i.e. 192.168.1.1:81 would trun lights on 192.168.1.1:82 would turn off?
Maybe a bit quick and dirty but i really would like to get some interaction over IPfor my arduino, even the out-the-box LED blinky example doesn't work for me, otherwise id chop that up and put some other function in there

Please make some sketch level functions, id even pay someone.
booboobooboo
 
Posts: 2
Joined: Sat Jul 18, 2009 2:34 am

Re: Sketch/Application requests

Postby gsxrex » Sun Jul 19, 2009 8:26 pm

First, my apologies for a late response. I was out of town this entire weekend.

Ok, you've all been heard in the ease of use department. I agree that unless you have some programming skills, the current driver code is hard to use. But we'll be fixing that soon.

Currently Ben has been working hard on enabling other features in the base driver code, like UDP. Now, we should have some "free" time to work on a better front end, to help the masses quickly and easily use the shield. Ben is also working on making a compatible library with the existing ethershield library, so hopefully that will make for a better plug and play with existing code that uses ethernet.

I'll take all the suggestions listed previously and work then into a better front end. I'll post updates with the new code front end and features as they are available.
User avatar
gsxrex
 
Posts: 115
Joined: Thu Apr 30, 2009 9:49 am

Re: Sketch/Application requests

Postby comperem » Mon Jul 20, 2009 9:33 am

gsxrex - I have no doubt this software will develop into very usable stable code and am interested to see how you make things easier for end-users.

In the mean time I figured out the plumbing between the top-level sketch loop() function and the WiShield's handle_connection() function. By adding a char outBoundBuffer[100] to the appstate struct (in socketapp.h) and modifying the WiShield::run() method to copy data from loop() to handle_connection() each time run() gets ticked, the one-way datapath is achieved. You could just as easily use larger buffers (for, say, 10 sensor numbers) and also go the other way as well for bi-directional client-server communications from main().

Code: Select all
void WiShield::run(int loopCnt)
{
   // retrieve the socket_app_state and place data from main() into the outBoundBuffer[] before calling stack_process()
   struct socket_app_state *s = &(uip_conn->appstate);
   memcpy(s->outBoundBuffer,&loopCnt,sizeof(int));

   stack_process();
   zg_drv_process();
}


Having figured this out raises another question though. It seems the run() method needs to be ticked a number of times for it to sequence its way through the tcp/ip stack state and do the communications. After putting a 1 second delay in the loop() it slowed things down enough to figure out that run() needs to be ticked multiple times for a single data transfer. This is slightly different than the posix send() function. This is perfectly understandable on a microcontroller that cannot spawn a separate process in the background.

Here is the output of a modified example client-side application that connects to the WiShield:

./main.tcp.client.arduino.exe
connected to WiShield
loopCnt=[11], Hello. What is you name?
abc
Hello abc
./main.tcp.client.arduino.exe
connected to WiShield
loopCnt=[31], Hello. What is you name?
def
Hello def
./main.tcp.client.arduino.exe
connected to WiShield
loopCnt=[98], Hello. What is you name?
ghi
Hello ghi


Notice the loopCnt is 11, 31, and 98. This corresponds to about 11 seconds of runtime, then 31 seconds, then about 98 seconds. This tells me that run() needs to be ticked as fast as possible to complete the wireless communications as fast as possible. The rest of the code in loop() needs to be written with this understanding. For example, something like this may be warranted:

Code: Select all
loop() {
   // do some other stuff
   doSomeOtherStuff();

   // send/receive over tcp/ip
   while (!tcpComplete()) {
      WiFi.run( loopCnt );
   }
}


Also I have only medium confidence this is the 'right' way to move data from main() to the sending and receiving portion of the tcp/ip stack. It is one way for sure but I am interested seeing what you guys come up with as a more well-thought-out approach.

Make sense...? ...benquark?

Marc
comperem
 
Posts: 12
Joined: Mon Jul 13, 2009 6:34 am

UDP sketch that sets time via NTP

Postby aerodyno » Wed Aug 05, 2009 1:20 pm

I just got my WiShield in the mail the other day. It's pretty sweet -- I've got the webserver working and have some cool applications in mind!

A great piece of sample code for UDP would be setting time on the Arduino using NTP. So when you switch on your arduino, it connects and gets the latest time, and then you can do whatever you want with that.

It would use the datetime library from the playground, and there is an NTP library out there, but it looks like we'll need to adapt it to work with our UDP implementation. I haven't taken a crack at this yet. Can someone give me some suggestions? First, do you think this is a doable project?

Datetime class:
http://www.arduino.cc/playground/Code/DateTime

NTP library:
http://github.com/cynshard/arduino-ntp/tree/master

Thanks guys!
-s
aerodyno
 
Posts: 65
Joined: Tue Aug 04, 2009 8:42 pm

Re: Sketch/Application requests - POST

Postby Chief Robot » Mon Oct 12, 2009 10:02 am

Hi,
Does anyone have an example of a POSTrequest sketch.
Specifically I want to post to a PHP page.

Thanks.
User avatar
Chief Robot
 
Posts: 36
Joined: Thu May 07, 2009 10:47 am

Re: Sketch/Application requests

Postby GregEigsti » Mon Oct 12, 2009 11:18 am

Take a look at the Pachube sketch in the following thread. You will need to modify it to do what you want but it should get you on your way. A word of warning - this script uses an HTTP POST to simulate an HTTP PUT so you will need to play with it a bit to do a pure POST (around the url global variable).

http://asynclabs.com/forums/viewtopic.php?f=15&t=86&start=10
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: Sketch/Application requests

Postby Chief Robot » Wed Oct 14, 2009 9:13 am

thanks Greg. I'll give that a try.
User avatar
Chief Robot
 
Posts: 36
Joined: Thu May 07, 2009 10:47 am

OSC AND LOCAL NETWORK SKETCH.

Postby risla » Thu Dec 10, 2009 10:47 am

Hi i think it would open up many possibilities to have a sample sketch making it possible for it to speak open sound control.
With that you could make a local network and control the arduino from the many different and popular osc controllers made for the Iphone/ipod touch.

This would open up the doors for a lot of us that tinker with these things. Making it possible to build the HARDWARE side to these controller as the arduino can speak dmx or midi and alot of other languages.

Imagine your iphone/ipod touch as a small wireless LEMUR communicating through the wishield to the arduino and then with your hardware such as midi controlled drum machines, synthesizers, dmx lightning and other hardware with no need of the a pc.

If you would make this possible this would make a lot of people interested for sure.

best regards risla
risla
 
Posts: 4
Joined: Sat Oct 10, 2009 6:34 am

Re: Sketch/Application requests

Postby GregEigsti » Thu Dec 10, 2009 8:04 pm

The desire to have an OSC sample script is not new; from what I understand it is a fairly simple protocol. I was going to take a look at creating such a script but don't currently have a need for OSC + WiShield. Maybe you could help generate some interest by letting me know what awesome scenarios can be achieved with OSC ;)

Greg
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

OSC thoughts

Postby willtris » Fri Dec 11, 2009 6:46 pm

I would just like to add my voice to risla's interest in OSC sketch development - I am keen to set up environments where multiple folk with smart-phones can use OSC across wifi to drive multiple light-sound 'instruments' as a kind of pick-up orchestra - the ability to use WiShield/arduinos as the basis for the embedded controllers is big plus -

Thanks risla and Greg for starting this thread - I know from an earlier discussion when I was first checking out the WiShield that Brad was thinking of OSC as an interesting direction - hopefully a few other folk are having the same thoughts and will want to explore this too - I'm guessing it should bring a lot of folk from the OSC end of things to WiShield - there is a lightweight version of microOSC that is being set up for similar local embedded device use - but so far it is compatible with two hardware units that are not arduinos - and, as far as I know, don't these don't have wifi solutions - could be a good opportunity for WiShield/Arduino to do impromptu networks for musicians and artists...

regards,

willtris
willtris
 
Posts: 2
Joined: Thu Aug 06, 2009 1:47 pm

PreviousNext

Return to Sketches and Applications

Who is online

Users browsing this forum: No registered users and 2 guests

cron