Skip to content

Commit eab5de8

Browse files
updated button library
1 parent 5e2acff commit eab5de8

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

electroblocks/core.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,13 @@ def motion_distance_cm(self):
245245

246246
# Button Methods
247247
def config_button(self, pin):
248-
self._send(f"register:bt::{pin}")
248+
self._send(f"register::bt::{pin}")
249249
self._add_pin(ComponentPins.BUTTON, pin)
250250

251251
def is_button_pressed(self, pin):
252-
return self._find_sensor_str(pin, "bt") == "0"
252+
# The firmware will return 1 if the pin is LOW
253+
# This works because we always use pullup resistor.
254+
return self._find_sensor_str(pin, "bt") == "1"
253255

254256
# Servo Methods
255257
def config_servo(self, pin):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "electroblocks"
7-
version = "0.1.19"
7+
version = "0.1.20"
88
description = "Python client library to interact with ElectroBlocks Arduino firmware"
99
authors = [
1010
{ name = "Noah Glaser", email = "[email protected]" }

0 commit comments

Comments
 (0)