This is the end gate portion of a pinewood derby timer that uses an mbed. It communicates via HTTP to a web server that is doing the racer control and race management. Still need to put all that code together into a package on the net.

Dependencies:   EthernetNetIf mbed HTTPServer Servo

Committer:
dminear
Date:
Wed Mar 09 05:09:42 2011 +0000
Revision:
0:74139f5b6180
Initial release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dminear 0:74139f5b6180 1 /*
dminear 0:74139f5b6180 2 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
dminear 0:74139f5b6180 3
dminear 0:74139f5b6180 4 Permission is hereby granted, free of charge, to any person obtaining a copy
dminear 0:74139f5b6180 5 of this software and associated documentation files (the "Software"), to deal
dminear 0:74139f5b6180 6 in the Software without restriction, including without limitation the rights
dminear 0:74139f5b6180 7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
dminear 0:74139f5b6180 8 copies of the Software, and to permit persons to whom the Software is
dminear 0:74139f5b6180 9 furnished to do so, subject to the following conditions:
dminear 0:74139f5b6180 10
dminear 0:74139f5b6180 11 The above copyright notice and this permission notice shall be included in
dminear 0:74139f5b6180 12 all copies or substantial portions of the Software.
dminear 0:74139f5b6180 13
dminear 0:74139f5b6180 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
dminear 0:74139f5b6180 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
dminear 0:74139f5b6180 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
dminear 0:74139f5b6180 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
dminear 0:74139f5b6180 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
dminear 0:74139f5b6180 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
dminear 0:74139f5b6180 20 THE SOFTWARE.
dminear 0:74139f5b6180 21 */
dminear 0:74139f5b6180 22
dminear 0:74139f5b6180 23 #ifndef SIMPLE_HANDLER3_H
dminear 0:74139f5b6180 24 #define SIMPLE_HANDLER3_H
dminear 0:74139f5b6180 25
dminear 0:74139f5b6180 26 #include "../HTTPRequestHandler.h"
dminear 0:74139f5b6180 27 #include "mbed.h"
dminear 0:74139f5b6180 28
dminear 0:74139f5b6180 29 class SimpleHandler3 : public HTTPRequestHandler
dminear 0:74139f5b6180 30 {
dminear 0:74139f5b6180 31 public:
dminear 0:74139f5b6180 32 SimpleHandler3(const char* rootPath, const char* path, TCPSocket* pTCPSocket);
dminear 0:74139f5b6180 33 virtual ~SimpleHandler3();
dminear 0:74139f5b6180 34
dminear 0:74139f5b6180 35 //protected:
dminear 0:74139f5b6180 36 static inline HTTPRequestHandler* inst(const char* rootPath, const char* path, TCPSocket* pTCPSocket) { return new SimpleHandler3(rootPath, path, pTCPSocket); } //if we ever could do static virtual functions, this would be one
dminear 0:74139f5b6180 37
dminear 0:74139f5b6180 38 virtual void doGet();
dminear 0:74139f5b6180 39 virtual void doPost();
dminear 0:74139f5b6180 40 virtual void doHead();
dminear 0:74139f5b6180 41
dminear 0:74139f5b6180 42 virtual void onReadable(); //Data has been read
dminear 0:74139f5b6180 43 virtual void onWriteable(); //Data has been written & buf is free
dminear 0:74139f5b6180 44 virtual void onClose(); //Connection is closing
dminear 0:74139f5b6180 45 void raiseGate();
dminear 0:74139f5b6180 46 void deenergizeSol();
dminear 0:74139f5b6180 47 void energizeSol();
dminear 0:74139f5b6180 48 void turnoffleds();
dminear 0:74139f5b6180 49 void ledcheck();
dminear 0:74139f5b6180 50 };
dminear 0:74139f5b6180 51
dminear 0:74139f5b6180 52 #endif