Skip to content

Commit 60f05e7

Browse files
authored
Fix spelling + add comments
- Fixed self.SPEKER - Added more comments - Removed unused code and imports
1 parent 5ed6bf8 commit 60f05e7

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

picogo.py

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
import time, board, pwmio, digitalio as dio, analogio as aio, adafruit_hcsr04, neopixel, busio, fourwire, displayio, audiopwmio
1+
import time, board, pwmio, digitalio as dio, analogio as aio, adafruit_hcsr04, neopixel, busio, fourwire, displayio
22
from adafruit_st7789 import ST7789
33

4-
def sleep_us(microseconds : int):
5-
start = time.monotonic_ns()
6-
while time.monotonic_ns() - start < microseconds * 1000:
7-
pass
8-
94
class PicoGo:
10-
def __init__(self, np_auto_write : bool = True, use_onboard_ble : bool = True):
5+
def __init__(self, np_auto_write : bool = True):
116
# Motor
127
self.MOTOR_PWM_A = pwmio.PWMOut(board.GP16, frequency=1000)
138
self.MOTOR_PWM_B = pwmio.PWMOut(board.GP21, frequency=1000)
@@ -48,13 +43,14 @@ def __init__(self, np_auto_write : bool = True, use_onboard_ble : bool = True):
4843
self.DISPLAY = ST7789(self.DISPLAY_BUS, width=240, height=135, rotation=270, rowstart=40, colstart=53)
4944

5045
# Buzzer
51-
# No working, because all timers are in use
52-
# self.SPEKER = audiopwmio.PWMAudioOut(board.GP4)
46+
# Not working, because all timers are in use
47+
# self.SPEAKER = audiopwmio.PWMAudioOut(board.GP4)
5348

5449
# Bluetooth module
5550
# No Adafruit BLE, because CTS and RTS aren't connected
5651
self.BLE = busio.UART(board.GP0, board.GP1, baudrate=115200)
57-
52+
53+
# Range: -1.0 (backwards) to 1.0 (forwards), 0 (stop)
5854
def set_motors(self, a : float | None, b : float | None):
5955
if a != None:
6056
a = min(1, max(-1, a))
@@ -91,6 +87,7 @@ def read_battery_percentage(self):
9187
# No freaking clue what this does, just copied it from the original
9288
return min(max((self.BATTERY.value * 3.3 / 65535 * 2 - 3) * 100 / 1.2, 0), 100)
9389

90+
# Run module directly to check if everything initilizes properly
9491
if __name__ == "__main__":
9592
print("Initializing...")
9693
go = PicoGo()

0 commit comments

Comments
 (0)