Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
- # See LICENSE for details.
- from twisted.internet import reactor, protocol
- from twisted.protocols.basic import LineReceiver
- #from pyroomba import *
- class RoombaPro(LineReceiver):
- """This is .... """
- #def __init__(self):
- #roomba = None
- def connectionMade(self):
- "Starting Roomba"
- #roomba = RoombaClassic(2)
- #roomba.start()
- #roomba.safe()
- def lineReceived(self, data):
- "As soon as any data is received, write it back."
- #roomba.drive(255,0)
- print data
- self.sendLine(sendSensors())
- def connectionLost(self, reason):
- "Stop Roomba"
- #roomba.drive(0,0)
- #roomba.stop()
- #roomba.close()
- def sendSensors(self):
- return "Test"
- def main():
- """This runs the protocol on port 8000"""
- factory = protocol.ServerFactory()
- factory.protocol = RoombaPro
- reactor.listenTCP(8000, factory)
- reactor.run()
- # this only runs if the module was *not* imported
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement