Difference between revisions of "Space state"
m (Featured page to inform everyone space state is working again) |
m (Reverted edits by Prodigity (talk) to last revision by Eagle00789) |
||
Line 1: | Line 1: | ||
− | |||
{{Project | {{Project | ||
|State=Completed, Fixed | |State=Completed, Fixed | ||
− | |Members=Vicarious, xopr ( CoolePascal ) | + | |Members=Vicarious, xopr ( CoolePascal ) |
|Description=Show the current state (open or closed) of our space | |Description=Show the current state (open or closed) of our space | ||
}} | }} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<strike>For now we'll use our Skype account "ACK.space" to show whether the space is currently open or closed. Later we'll have a better set up.</strike> | <strike>For now we'll use our Skype account "ACK.space" to show whether the space is currently open or closed. Later we'll have a better set up.</strike> | ||
Line 39: | Line 13: | ||
This is the perl script that does the thing on te Mac (note that this code is not yet the actual running version) | This is the perl script that does the thing on te Mac (note that this code is not yet the actual running version) | ||
− | |||
#!/usr/bin/perl -wT | #!/usr/bin/perl -wT | ||
# Title : spacestate.pl | # Title : spacestate.pl | ||
Line 81: | Line 54: | ||
sleep(1); | sleep(1); | ||
} | } | ||
− | |||
Here to put the php script running on the webserver. | Here to put the php script running on the webserver. | ||
− | |||
<?php | <?php | ||
some code | some code | ||
?> | ?> | ||
− | |||
[[Image:Spacestate switch.jpg|left|400px|Spacestate switch.jpg]][[Image:Spacestate closed.jpg|left|400px|Spacestate closed.jpg]] | [[Image:Spacestate switch.jpg|left|400px|Spacestate switch.jpg]][[Image:Spacestate closed.jpg|left|400px|Spacestate closed.jpg]] | ||
[[Image:Spacestate open.jpg|left|400px|Spacestate open.jpg]] | [[Image:Spacestate open.jpg|left|400px|Spacestate open.jpg]] |
Revision as of 19:34, 28 October 2014
Project: Space state | |
---|---|
Featured: | |
State | Completed, Fixed"Fixed" is not in the list (Active, Planned, Completed, Stalled, Impossible) of allowed values for the "State of Project" property. |
Members | Vicarious, xopr ( CoolePascal ) |
GitHub | No GitHub project defined. Add your project here. |
Description | Show the current state (open or closed) of our space |
Picture | |
No project picture! Fill in form Picture or Upload a jpeg here |
For now we'll use our Skype account "ACK.space" to show whether the space is currently open or closed. Later we'll have a better set up.
Although we forgot to update this page, the SpaceState switch is working fine now. This is how it's done
We found an huge powerswitch which we mounted to the space wall this switch is connected with a cable to the Space-Mac using an serial to usb converter. On the Mac a perl scripts reads the space state. If the space-state changes, the perlscripts uses wget to call an php script on the ACKspace website. The php scripts sets an space-state variable in a file. The same script is used to read the space-state variable and show the status on the webpage.
This is the perl script that does the thing on te Mac (note that this code is not yet the actual running version)
#!/usr/bin/perl -wT # Title : spacestate.pl # Function : read spacestate switch en set action accordingly # Author : Pascal Schiks (C) 2011
# my $serialdev="/dev/tty.PL2303-000061FD"; use strict; use IO::Handle; use Fcntl;
my $TIOCMGET = 0x5415;
my $spacestate=0; my $lastspacestate=$spacestate; while(1) { if(sysopen(SERIAL, $serialdev, O_RDWR)) { my $mdmctl=""; my $ioresult; unless(($ioresult=ioctl(SERIAL, $TIOCMGET, $mdmctl))==-1) { $mdmctl = unpack('i',$mdmctl); $spacestate = ($mdmctl&64)==0 ? "open":"close"; print "$spacestate\n" if($spacestate ne $lastspacestate); } else { print "Weet ik veel Error\n"; } close(SERIAL); $lastspacestate = $spacestate; } else { print "Error, Could not open $serialdev\n"; } sleep(1); }
Here to put the php script running on the webserver.
<?php some code ?>