Exemplo n.º 1
0
def setgpiostate(id, state):
    pins().setpin(id, state)
    return str(pins().getpin(id))
Exemplo n.º 2
0
def getgpiostate(id):
    return str(pins().getpin(id))
Exemplo n.º 3
0
 def test_hwcontrol_pins_setpin_WhenCalledWithAnyPinNmberAndFalse_WillCallRPi_GPIO_OuputWithFalse(
         self):
     with mock.patch('RPi.GPIO.output') as mock_method:
         ret = pins().setpin(22, 'on')
         mock_method.assert_called_with(22, True)
Exemplo n.º 4
0
 def test_hwcontrol_pins_setpin_WhenCalledWithAnyPinNmberAndTrue_WillCallRPi_GPIO_OuputWithTrue(
         self):
     with mock.patch('hwcontrol.pins.setpin') as mock_method:
         ret = pins().setpin(22, False)
         mock_method.assert_called_with(22, False)
Exemplo n.º 5
0
 def test_hwcontrol_pins_getpin_WhenCalledWithAnyPinNumberAndMockedLow_ReturnsFalse(
         self):
     with mock.patch('RPi.GPIO.input', return_value=False):
         ret = pins().getpin(22)
         self.assertEqual(False, ret)