mirror of
https://github.com/blw1138/MercurySim.git
synced 2025-12-17 08:38:12 +00:00
Initial commit
This commit is contained in:
16
src/MercuryController.py
Normal file
16
src/MercuryController.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import serial
|
||||
|
||||
|
||||
class MercuryController:
|
||||
def __init__(self, port, baud):
|
||||
self.serial = serial.Serial(port, baud)
|
||||
self.serial.flushInput()
|
||||
|
||||
def led_on(self, pin):
|
||||
self.serial.write("LED {} on".format(pin))
|
||||
|
||||
def led_off(self, pin):
|
||||
self.serial.write("LED {} off".format(pin))
|
||||
|
||||
def set_servo_percent(self, servo, percent):
|
||||
self.serial.write("servo {0} {1}".format(servo, percent))
|
||||
Reference in New Issue
Block a user