def test_multiple_output(self): pin.setup([4, 5], pin.OUT) pin.output([4, 5], pin.HIGH) value4 = pin.get_output(4) value5 = pin.get_output(5) self.assertEqual(pin.HIGH, value4) self.assertEqual(pin.HIGH, value5) pin.cleanup(5)
def test_multiple_setup(self): pin.setup([4, 5, 6], pin.IN) pin.set_value(4, 0.4) pin.set_value(5, 0.5) pin.set_value(6, 0.6) value4 = pin.input(4) value5 = pin.input(5) value6 = pin.input(6) self.assertEqual(0.4, value4) self.assertEqual(0.5, value5) self.assertEqual(0.6, value6) pin.cleanup((5, 6))
import pin import control import time pin.load("config1.json") control.load("config1.json") control.move(80, 60) time.sleep(3) control.move(-100, 90) time.sleep(3) # reset the GPIOs pin.cleanup()
def tearDown(self): pin.cleanup(4)
def test_cleanup(self): pin.setup([1, 2], pin.OUT) pin.cleanup() self.assertRaises(pin.InputOutputError, pin.output, [1, 2], pin.HIGH)