-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge github.com:hackerdojo/hd-maglock
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/local/bin/python | ||
import sys, os, simplejson | ||
from twisted.python import log | ||
from twisted.internet import reactor, serialport | ||
from twisted.web import client as http, error as http_error | ||
from twisted.protocol import basic | ||
|
||
class RelayProtocol(basic.LineReceiver): | ||
# Here's an echo implementation to show you read/write | ||
def lineReceived(self, line): | ||
self.sendLine(self, line) | ||
|
||
|
||
if __name__ == "__main__": | ||
log.startLogging(sys.stdout) | ||
device = "/dev/ttyS0" | ||
baudrate = 4800 | ||
serialport.SerialPort(RelayProtocol(), device, reactor, baudrate=baudrate) | ||
reactor.run() |