I thought I would combine two fun Parallax offerings into a single project.
* Spinneret and FM Radio module.
The goal here is to have an FM radio which can be controlled from my android phone both across the room and across the world. The hardware for this project is easy, and I'll post software as we go along to help others replicate the project. See message two for project videos.
About the code:
I'm using Mike G's contest winning webserver software as the basis for this project. I've also lifted the control object from the FM Radio spin demo, and placed some of the commands into the Spinneret webserver.
Here's some of the important bits in the webserver code.
Start by configuring lines 14,15, and 16 to match your network settings...
The control page is located at http://WWW.IP.OR.NAME/hello.html
If you want to change the name, simply change line 670
Code:if(strcomp(Request.GetName(id), string("hello")))
Around line 730 is the code which creates the button controls. More controls could easily be added.
Around Line 700 is where I'm processing the returned data. I'm cheating a bit by examining only portion of the returned data. I've added some Parallax Serial Terminal code so that you can extend the cheat a bit by adding buttons, monitoring the terminal, then added the detected codes. I'm sure there is an elegant way to do this, but this hack works.Code:StringSend(id, string("<form>",13,10)) StringSend(id, string("<BR><BR>Oldbitcollector's Spinneret Controlradiocontrol Radio<BR><BR>",13,10)) StringSend(id, string("<button type=submit name=radiocontrol value=1>ON</button> ",13,10)) StringSend(id, string("<button type=submit name=radiocontrol value=0>OFF</BUTTON> <BR><BR> ",13,10)) StringSend(id, string("<button type=submit value=2 name=radiocontrol>VOLUME UP</button> ",13,10)) StringSend(id, string("<button type=submit value=3 name=radiocontrol>VOLUME DOWN</BUTTON> <BR><BR>",13,10)) StringSend(id, string("<button type=submit value=4 name=radiocontrol>SEARCH</button> ",13,10)) StringSend(id, string("</form>",13,10))
Code:pst.str(string("Cheap Input Detection:")) pst.dec(radiocontrol) pst.newline if radiocontrol == 92 or radiocontrol == 208 pst.str(string("OFF")) outa[23]:=0 FM.PowerOff
OBC



Reply With Quote



Bookmarks