Hive13 / openswitch

Code for the Hackerspace Open // Closed switch.

Home Page:http://www.hive13.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The 'Door Switch' or 'Is the Hackerspace Open?' switch has two main software 
components:
1. The microcontroller client code.
2. The webserver database and webpages.

######### 1. The Microcontroller ########
~~ The electrical components ~~
1. A standard lightswitch
2. An Arduino Mega with Ethernet Board
             
~~ The Code ~~
The micro remembers the last state of the switch, when the state changes
it sends out an HTTP 'GET' request to the webserver to 
'isOpen/logger.php?switch=[0|1]'. A switch state of '0' means the hackerspace is 
closed, a switch state of '1' means the hackerspace is open.

~~ Light Status Codes ~~
Waiting for response: Both LEDs solid
Cannot contact the network: Alternating blink of both LEDs
Cannot reach server: Simultaneous blink of both LEDS

######### 2. The Webserver ########
The webserver contains several parts:
1. A MySQL database with a 'doorEvents' table.
2. The logger.php page which accepts 'get' requests from client.
3. The checkStatus.php which polls the database for the current door status.
4. An index.html which uses javascript to refresh the icon when the status 
   changes.

About

Code for the Hackerspace Open // Closed switch.

http://www.hive13.org


Languages

Language:PHP 60.8%Language:C++ 31.1%Language:TSQL 4.0%Language:HTML 3.4%Language:Hack 0.8%