Exemple #1
0
def test_read_gpio_pin_analogue_value_bad_mode() -> None:
    """Test that we cannot read an analogue value in the wrong mode."""
    backend = SBArduinoConsoleBackend(
        "TestBoard",
        console_class=MockConsole,
    )

    backend._console.next_input = "4.3"  # type: ignore
    with pytest.raises(ValueError):
        assert backend.read_gpio_pin_analogue_value(5) == 4.3
Exemple #2
0
def test_read_gpio_pin_analogue_value() -> None:
    """Test that we can read an analogue value."""
    backend = SBArduinoConsoleBackend(
        "TestBoard",
        console_class=MockConsole,
    )

    backend._console.next_input = "4.3"  # type: ignore
    backend._pins[5].mode = GPIOPinMode.ANALOGUE_INPUT
    assert backend.read_gpio_pin_analogue_value(5) == 4.3