class Vulcanuino(object): def __init__(self, port_name=ARDUINO_PORT): self.serial_port = SerialPort(port_name, 9600) # Arduino resets when the serial port is open, give it time to boot up. time.sleep(5) def single_shot(self, pause_time=20): self.commence_firing() self.pause(pause_time) self.cease_fire() def commence_firing(self): self._write(COMMENCE_FIRING) def cease_fire(self): self._write(CEASE_FIRE) def pause(self, n=1): self._write(PAUSE * n) def _write(self, s): self.serial_port.write(s)
def __init__(self, port_name=ARDUINO_PORT): self.serial_port = SerialPort(port_name, 9600) # Arduino resets when the serial port is open, give it time to boot up. time.sleep(5)