Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
Use repr for debugging values in exception messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kierdavis committed Jul 18, 2019
1 parent e932029 commit fdaaa76
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions j5/backends/hardware/sb/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,14 @@ def read_gpio_pin_digital_state(self, identifier: int) -> bool:
f"in order to read the digital state.")
results = self._command("R", str(identifier))
if len(results) != 1:
raise CommunicationError(f"Invalid response from Arduino: {results}")
raise CommunicationError(f"Invalid response from Arduino: {results!r}")
result = results[0]
if result == "H":
return True
elif result == "L":
return False
else:
raise CommunicationError(f"Invalid response from Arduino: {result}")
raise CommunicationError(f"Invalid response from Arduino: {result!r}")

def read_gpio_pin_analogue_value(self, identifier: int) -> float:
"""Read the analogue voltage of the GPIO pin."""
Expand All @@ -256,7 +256,7 @@ def read_gpio_pin_analogue_value(self, identifier: int) -> float:
if pin_name == f"a{analogue_pin_num}":
voltage = (int(reading) / 1024.0) * 5.0
return voltage
raise CommunicationError(f"Invalid response from Arduino: {results}")
raise CommunicationError(f"Invalid response from Arduino: {results!r}")

def write_gpio_pin_dac_value(self, identifier: int, scaled_value: float) -> None:
"""Write a scaled analogue value to the DAC on the GPIO pin."""
Expand Down

0 comments on commit fdaaa76

Please sign in to comment.