Created Tue, 24 Jun 2014 18:56:32 +0000 by Jay Weeks
Tue, 24 Jun 2014 18:56:32 +0000
I'm working on building a tutorial for the networked equivalent of the basic LED blinking tutorial on the WF32 (ie. blinking an LED based off input from a webpage), but I'm also very new to anything to do with networks so I'm trying to modify the HTTPsrv example instead of coding everything from scratch. I've got two ideas for how to do this but I'd like to get some feedback on them before I dig myself too deep.
I've sifted through the code enough to get a feel for how it works, but please correct me if I'm wrong. My understanding is that it works as two state machines, one for the server and one for the client. The server state machine in ProcessServer.cpp takes care of everything the server needs to have done, mostly to do with connecting and disconnecting. Then the client state machine in ProcessClient.cpp takes care of communication with the client and doing whatever it is they need.
Like I said, I have two ideas for how to attack this.
The first would be to make a new state or set of states within the client state machine which would take care of whatever IO functions I'd want to do (in this case blinking an LED). This is advantageous because it will keep the server from hanging when functions get bigger and bigger (assuming they're split up into appropriately small states).
My other idea is to make a sort of instruction variable that will get dealt with after the ProcessServer() call in the loop section of the WebServer.pde sketch exist. This is advantageous because it would allow new users (like me) to ignore all the complicated background code, and focus on their code in the familiar one-page sketch format they're probably used to.
Will either of these ideas work? Is there some other more standard or easier method I should be using instead, or am I on the right track?
Sat, 28 Jun 2014 19:38:35 +0000
However, this means that you probably want to work in the MPLAB X environment using MicroChip libraries. I took the MicroChip WiFiG demo .... which has very similar hardware to the WF32 .... and got it running on the WF32. I modified it to toggle and display the user LEDs and read the state of the 2 user buttons.
Let me know if you want further information on the MicroChip demo. If you want to stay in MPIDE, you may take a look at the project at:
Warning: It's quite complex!