Description
What were you trying to do?
run a code on circuitpython mode to control ScoutsMake Robot with azul board
What steps did you take to trigger the issue?
I followed adrafruits procedure to have my Mac recognize the ScoutMake Robot with the Azul board. I was able I was able to see it as recognized in Mu. There is no "run" button in CircuitPython mode which leaves me puzzled on how to run a code.
The azul board came with a program loaded. Initially the board's OLED showed a welcome message.
I linked the module via bluefruit to the bluefruit LE connect mobile app.
Now I cannot get MU to recognize the Azul module on the feather.
Maybe the code on the feather was deleted or overwritten. I have the code from github and would like to reload it. But MU will not recognize my feather/azul.
What did you expect to happen?
- that mu will recognize my feather/azul
What actually happened?
No response
Operating System Version
mac ventura 13.2.1
Mu Version
1.2.0
Other Info
No response
Editor Log
2023-05-31 00:14:32,985 - mu.logic:756(check_usb) INFO: circuitpython device connected on port: /dev/cu.usbmodem101(VID: 0x239A, PID: 0x80BE, manufacturer: 'TinkeringTech LLC')
2023-05-31 00:14:41,962 - mu.logic:739(check_usb) INFO: circuitpython device disconnected on port: /dev/cu.usbmodem101(VID: 0x239A, PID: 0x80BE, manufacturer TinkeringTech LLC)
2023-05-31 00:36:17,320 - mu.interface.main:1075(show_confirmation) DEBUG: There is un-saved work, exiting the application will cause you to lose it.
2023-05-31 00:36:17,322 - mu.interface.main:1076(show_confirmation) DEBUG: None
2023-05-31 00:38:50,738 - mu.settings:169(save) DEBUG: Saving to /Users/judsonbelmont/Library/Application Support/mu/session.json
2023-05-31 00:38:50,740 - mu.logic:1430(quit) INFO: Quitting.
2023-05-31 00:38:50,742 - mu.settings:169(save) DEBUG: Saving to /Users/judsonbelmont/Library/Application Support/mu/session.json
2023-05-31 00:38:50,742 - mu.settings:169(save) DEBUG: Saving to /Users/judsonbelmont/Library/Application Support/mu/venv.json
2023-05-31 09:31:44,327 - root:283(run) INFO:
Starting Mu 1.2.0
2023-05-31 09:31:44,328 - root:284(run) INFO: uname_result(system='Darwin', node='MacBook-Air.local', release='22.3.0', version='Darwin Kernel Version 22.3.0: Mon Jan 30 20:39:35 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T8103', machine='x86_64', processor='i386')
2023-05-31 09:31:44,368 - root:285(run) INFO: Platform: macOS-13.2.1-x86_64-i386-64bit
2023-05-31 09:31:44,369 - root:286(run) INFO: Python path: ['/Applications/Mu Editor.app/Contents/Resources/Python/lib/python38.zip', '/Applications/Mu Editor.app/Contents/Resources/Python/lib/python3.8', '/Applications/Mu Editor.app/Contents/Resources/Python/lib/python3.8/lib-dynload', '/Applications/Mu Editor.app/Contents/Resources/Python/lib/python3.8/site-packages']
2023-05-31 09:31:44,369 - root:287(run) INFO: Language code: en_US
2023-05-31 09:31:44,369 - mu.settings:220(load) WARNING: No settings file found at /Users/judsonbelmont/Library/Application Support/mu/settings.json; skipping
2023-05-31 09:31:46,959 - mu.virtual_environment:619(ensure_and_create) INFO: Added log handler.
2023-05-31 09:31:46,960 - mu.virtual_environment:630(ensure_and_create) DEBUG: Checking virtual environment; attempt #1.
2023-05-31 09:31:46,960 - mu.virtual_environment:719(ensure_path) INFO: Virtual Environment found at: /Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104
2023-05-31 09:31:46,961 - mu.virtual_environment:732(ensure_interpreter) INFO: Interpreter found at: /Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/python
2023-05-31 09:31:46,961 - mu.virtual_environment:463(run_subprocess) INFO: Running ('/Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/python', '-c', 'import sys; print("%s%s" % sys.version_info[:2])') with kwargs {'shell': False}
2023-05-31 09:31:47,116 - mu.virtual_environment:475(run_subprocess) DEBUG: Process returned 0; output: 38
2023-05-31 09:31:47,116 - mu.virtual_environment:786(ensure_interpreter_version) INFO: Both interpreters at version 38
2023-05-31 09:31:47,118 - mu.virtual_environment:815(ensure_pip) INFO: Pip found at: /Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/pip
2023-05-31 09:31:47,121 - mu.virtual_environment:798(ensure_key_modules) DEBUG: Verifying import of: pgzero
2023-05-31 09:31:47,121 - mu.virtual_environment:463(run_subprocess) INFO: Running ('/Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/python', '-c', 'import pgzero') with kwargs {'shell': False}
2023-05-31 09:31:47,163 - mu.virtual_environment:475(run_subprocess) DEBUG: Process returned 0; output: No output received.
2023-05-31 09:31:47,163 - mu.virtual_environment:798(ensure_key_modules) DEBUG: Verifying import of: flask
2023-05-31 09:31:47,163 - mu.virtual_environment:463(run_subprocess) INFO: Running ('/Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/python', '-c', 'import flask') with kwargs {'shell': False}
2023-05-31 09:31:47,464 - mu.virtual_environment:475(run_subprocess) DEBUG: Process returned 0; output: No output received.
2023-05-31 09:31:47,464 - mu.virtual_environment:798(ensure_key_modules) DEBUG: Verifying import of: ipykernel
2023-05-31 09:31:47,465 - mu.virtual_environment:463(run_subprocess) INFO: Running ('/Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/python', '-c', 'import ipykernel') with kwargs {'shell': False}
2023-05-31 09:31:48,719 - mu.virtual_environment:475(run_subprocess) DEBUG: Process returned 0; output: No output received.
2023-05-31 09:31:48,720 - mu.virtual_environment:798(ensure_key_modules) DEBUG: Verifying import of: ipython_genutils
2023-05-31 09:31:48,720 - mu.virtual_environment:463(run_subprocess) INFO: Running ('/Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/python', '-c', 'import ipython_genutils') with kwargs {'shell': False}
2023-05-31 09:31:48,751 - mu.virtual_environment:475(run_subprocess) DEBUG: Process returned 0; output: No output received.
2023-05-31 09:31:48,751 - mu.virtual_environment:662(ensure_and_create) INFO: Valid virtual environment found at /Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104
2023-05-31 09:31:48,751 - mu.settings:169(save) DEBUG: Saving to /Users/judsonbelmont/Library/Application Support/mu/venv.json
2023-05-31 09:31:48,789 - mu.logic:777(init) INFO: Setting up editor.
2023-05-31 09:31:48,791 - mu.logic:801(init) INFO: Log directory: /Users/judsonbelmont/Library/Logs/mu
2023-05-31 09:31:48,791 - mu.logic:802(init) INFO: Data directory: /Users/judsonbelmont/Library/Application Support/mu
2023-05-31 09:31:48,791 - mu.logic:816(setup) INFO: Available modes: python, snek, circuitpython, microbit, esp, web, pyboard, debugger, pygamezero, lego, pico
2023-05-31 09:31:48,791 - mu.modes.base:61(get_default_workspace) INFO: Using workspace /Users/judsonbelmont/mu_code from settings file
2023-05-31 09:31:48,878 - mu.modes.base:61(get_default_workspace) INFO: Using workspace /Users/judsonbelmont/mu_code from settings file
2023-05-31 09:31:48,878 - mu.logic:1583(change_mode) INFO: Workspace directory: /Users/judsonbelmont/mu_code
2023-05-31 09:31:48,878 - mu.logic:890(restore_session) DEBUG: <SessionSettings from /Users/judsonbelmont/Library/Application Support/mu/session.json>
2023-05-31 09:31:48,886 - mu.logic:1015(_load) INFO: Loading script from: /Users/judsonbelmont/mu_code/scoutmakesHello.py
2023-05-31 09:31:48,887 - mu.logic:332(read_and_decode) DEBUG: Trying to decode with utf-8
2023-05-31 09:31:48,887 - mu.logic:335(read_and_decode) INFO: Decoded with utf-8
2023-05-31 09:31:48,887 - mu.logic:348(read_and_decode) DEBUG: Detected newline '\n'
2023-05-31 09:31:48,887 - mu.logic:1114(_load) DEBUG: """
This test will initialize the BLE module and accept commands from the Bluetooth app controller arrows and manipulate
the onboard NEOPIXEL colors.
To use:
- Open the BLE app
- Connect to the CIRCUITPYTHON board
- Select the controller
- Selcect control
- Press the arrows to see the NEOPIXEL change color according to the following commands:
RIGHT = RED
LEFT = BLUE
UP = GREEN
DOWN = WHITE
"""
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
from adafruit_bluefruit_connect.packet import Packet
Only the packet classes that are imported will be known to Packet.
from adafruit_bluefruit_connect.button_packet import ButtonPacket
import time
import board
import pulseio
import neopixel
pixel_pin = board.NEOPIXEL
num_pixels = 1
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.3, auto_write=False)
RED = (255, 0, 0)
YELLOW = (255, 150, 0)
GREEN = (0, 255, 0)
CYAN = (0, 255, 255)
BLUE = (0, 0, 255)
PURPLE = (180, 0, 255)
WHITE = (255, 255, 255)
ble = BLERadio()
uart_service = UARTService()
advertisement = ProvideServicesAdvertisement(uart_service)
while True:
ble.start_advertising(advertisement)
while not ble.connected:
pass
# Now we're connected
while ble.connected:
if uart_service.in_waiting:
# Packet is arriving.
packet = Packet.from_stream(uart_service)
if isinstance(packet, ButtonPacket) and packet.pressed:
if packet.button == ButtonPacket.RIGHT: # RIGHT button pressed
pixels.fill(RED)
pixels.show()
# Increase or decrease to change the speed of the solid color change.
time.sleep(1)
elif packet.button == ButtonPacket.LEFT: # LEFT button pressed
pixels.fill(BLUE)
pixels.show()
time.sleep(1)
elif packet.button == ButtonPacket.UP: # UP button pressed
pixels.fill(GREEN)
pixels.show()
time.sleep(1)
elif packet.button == ButtonPacket.DOWN: # DOWN button pressed
pixels.fill(WHITE)
pixels.show()
time.sleep(1) # Write your code here :-)
2023-05-31 09:31:48,963 - mu.logic:1015(_load) INFO: Loading script from: /Volumes/CIRCUITPY/lib/rda5807m.py
2023-05-31 09:31:48,963 - mu.logic:1026(_load) INFO: The file /Volumes/CIRCUITPY/lib/rda5807m.py does not exist.
2023-05-31 09:31:48,963 - mu.logic:912(restore_session) INFO: Loaded files.
2023-05-31 09:31:48,963 - mu.logic:918(restore_session) INFO: User defined environment variables: {}
2023-05-31 09:31:48,963 - mu.logic:923(restore_session) INFO: Minify scripts on micro:bit? False
2023-05-31 09:31:49,015 - mu.modes.base:61(get_default_workspace) INFO: Using workspace /Users/judsonbelmont/mu_code from settings file
2023-05-31 09:31:49,036 - mu.interface.main:1047(show_message) DEBUG: Could not find an attached CircuitPython device.
2023-05-31 09:31:49,036 - mu.interface.main:1048(show_message) DEBUG: Python files for CircuitPython devices are stored on the device. Therefore, to edit these files you need to have the device plugged in. Until you plug in a device, Mu will use the directory found here:
/Users/judsonbelmont/mu_code
...to store your code.
2023-05-31 09:31:56,939 - mu.logic:1583(change_mode) INFO: Workspace directory: /Users/judsonbelmont/mu_code
2023-05-31 11:03:18,221 - mu.settings:169(save) DEBUG: Saving to /Users/judsonbelmont/Library/Application Support/mu/session.json
2023-05-31 11:03:18,244 - mu.logic:1430(quit) INFO: Quitting.
2023-05-31 11:03:18,248 - mu.settings:169(save) DEBUG: Saving to /Users/judsonbelmont/Library/Application Support/mu/session.json
2023-05-31 11:03:18,251 - mu.settings:169(save) DEBUG: Saving to /Users/judsonbelmont/Library/Application Support/mu/venv.json
2023-05-31 11:18:02,796 - root:283(run) INFO:
Starting Mu 1.2.0
2023-05-31 11:18:02,797 - root:284(run) INFO: uname_result(system='Darwin', node='MacBook-Air.local', release='22.3.0', version='Darwin Kernel Version 22.3.0: Mon Jan 30 20:39:35 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T8103', machine='x86_64', processor='i386')
2023-05-31 11:18:02,842 - root:285(run) INFO: Platform: macOS-13.2.1-x86_64-i386-64bit
2023-05-31 11:18:02,842 - root:286(run) INFO: Python path: ['/Applications/Mu Editor.app/Contents/Resources/Python/lib/python38.zip', '/Applications/Mu Editor.app/Contents/Resources/Python/lib/python3.8', '/Applications/Mu Editor.app/Contents/Resources/Python/lib/python3.8/lib-dynload', '/Applications/Mu Editor.app/Contents/Resources/Python/lib/python3.8/site-packages']
2023-05-31 11:18:02,842 - root:287(run) INFO: Language code: en_US
2023-05-31 11:18:02,842 - mu.settings:220(load) WARNING: No settings file found at /Users/judsonbelmont/Library/Application Support/mu/settings.json; skipping
2023-05-31 11:18:03,729 - mu.virtual_environment:619(ensure_and_create) INFO: Added log handler.
2023-05-31 11:18:03,729 - mu.virtual_environment:630(ensure_and_create) DEBUG: Checking virtual environment; attempt #1.
2023-05-31 11:18:03,730 - mu.virtual_environment:719(ensure_path) INFO: Virtual Environment found at: /Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104
2023-05-31 11:18:03,730 - mu.virtual_environment:732(ensure_interpreter) INFO: Interpreter found at: /Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/python
2023-05-31 11:18:03,730 - mu.virtual_environment:463(run_subprocess) INFO: Running ('/Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/python', '-c', 'import sys; print("%s%s" % sys.version_info[:2])') with kwargs {'shell': False}
2023-05-31 11:18:04,001 - mu.virtual_environment:475(run_subprocess) DEBUG: Process returned 0; output: 38
2023-05-31 11:18:04,001 - mu.virtual_environment:786(ensure_interpreter_version) INFO: Both interpreters at version 38
2023-05-31 11:18:04,005 - mu.virtual_environment:815(ensure_pip) INFO: Pip found at: /Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/pip
2023-05-31 11:18:04,007 - mu.virtual_environment:798(ensure_key_modules) DEBUG: Verifying import of: pgzero
2023-05-31 11:18:04,008 - mu.virtual_environment:463(run_subprocess) INFO: Running ('/Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/python', '-c', 'import pgzero') with kwargs {'shell': False}
2023-05-31 11:18:04,072 - mu.virtual_environment:475(run_subprocess) DEBUG: Process returned 0; output: No output received.
2023-05-31 11:18:04,073 - mu.virtual_environment:798(ensure_key_modules) DEBUG: Verifying import of: flask
2023-05-31 11:18:04,073 - mu.virtual_environment:463(run_subprocess) INFO: Running ('/Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/python', '-c', 'import flask') with kwargs {'shell': False}
2023-05-31 11:18:04,286 - mu.virtual_environment:475(run_subprocess) DEBUG: Process returned 0; output: No output received.
2023-05-31 11:18:04,286 - mu.virtual_environment:798(ensure_key_modules) DEBUG: Verifying import of: ipykernel
2023-05-31 11:18:04,286 - mu.virtual_environment:463(run_subprocess) INFO: Running ('/Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/python', '-c', 'import ipykernel') with kwargs {'shell': False}
2023-05-31 11:18:05,375 - mu.virtual_environment:475(run_subprocess) DEBUG: Process returned 0; output: No output received.
2023-05-31 11:18:05,375 - mu.virtual_environment:798(ensure_key_modules) DEBUG: Verifying import of: ipython_genutils
2023-05-31 11:18:05,375 - mu.virtual_environment:463(run_subprocess) INFO: Running ('/Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/python', '-c', 'import ipython_genutils') with kwargs {'shell': False}
2023-05-31 11:18:05,406 - mu.virtual_environment:475(run_subprocess) DEBUG: Process returned 0; output: No output received.
2023-05-31 11:18:05,406 - mu.virtual_environment:662(ensure_and_create) INFO: Valid virtual environment found at /Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104
2023-05-31 11:18:05,406 - mu.settings:169(save) DEBUG: Saving to /Users/judsonbelmont/Library/Application Support/mu/venv.json
2023-05-31 11:18:05,445 - mu.logic:777(init) INFO: Setting up editor.
2023-05-31 11:18:05,446 - mu.logic:801(init) INFO: Log directory: /Users/judsonbelmont/Library/Logs/mu
2023-05-31 11:18:05,447 - mu.logic:802(init) INFO: Data directory: /Users/judsonbelmont/Library/Application Support/mu
2023-05-31 11:18:05,447 - mu.logic:816(setup) INFO: Available modes: python, snek, circuitpython, microbit, esp, web, pyboard, debugger, pygamezero, lego, pico
2023-05-31 11:18:05,448 - mu.modes.base:61(get_default_workspace) INFO: Using workspace /Users/judsonbelmont/mu_code from settings file
2023-05-31 11:18:05,540 - mu.modes.base:61(get_default_workspace) INFO: Using workspace /Users/judsonbelmont/mu_code from settings file
2023-05-31 11:18:05,540 - mu.logic:1583(change_mode) INFO: Workspace directory: /Users/judsonbelmont/mu_code
2023-05-31 11:18:05,540 - mu.logic:890(restore_session) DEBUG: <SessionSettings from /Users/judsonbelmont/Library/Application Support/mu/session.json>
2023-05-31 11:18:05,546 - mu.logic:1015(_load) INFO: Loading script from: /Users/judsonbelmont/mu_code/scoutmakesHello.py
2023-05-31 11:18:05,546 - mu.logic:332(read_and_decode) DEBUG: Trying to decode with utf-8
2023-05-31 11:18:05,546 - mu.logic:335(read_and_decode) INFO: Decoded with utf-8
2023-05-31 11:18:05,547 - mu.logic:348(read_and_decode) DEBUG: Detected newline '\n'
2023-05-31 11:18:05,547 - mu.logic:1114(_load) DEBUG: """
This test will initialize the BLE module and accept commands from the Bluetooth app controller arrows and manipulate
the onboard NEOPIXEL colors.
To use:
- Open the BLE app
- Connect to the CIRCUITPYTHON board
- Select the controller
- Selcect control
- Press the arrows to see the NEOPIXEL change color according to the following commands:
RIGHT = RED
LEFT = BLUE
UP = GREEN
DOWN = WHITE
"""
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
from adafruit_bluefruit_connect.packet import Packet
Only the packet classes that are imported will be known to Packet.
from adafruit_bluefruit_connect.button_packet import ButtonPacket
import time
import board
import pulseio
import neopixel
pixel_pin = board.NEOPIXEL
num_pixels = 1
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.3, auto_write=False)
RED = (255, 0, 0)
YELLOW = (255, 150, 0)
GREEN = (0, 255, 0)
CYAN = (0, 255, 255)
BLUE = (0, 0, 255)
PURPLE = (180, 0, 255)
WHITE = (255, 255, 255)
ble = BLERadio()
uart_service = UARTService()
advertisement = ProvideServicesAdvertisement(uart_service)
while True:
ble.start_advertising(advertisement)
while not ble.connected:
pass
# Now we're connected
while ble.connected:
if uart_service.in_waiting:
# Packet is arriving.
packet = Packet.from_stream(uart_service)
if isinstance(packet, ButtonPacket) and packet.pressed:
if packet.button == ButtonPacket.RIGHT: # RIGHT button pressed
pixels.fill(RED)
pixels.show()
# Increase or decrease to change the speed of the solid color change.
time.sleep(1)
elif packet.button == ButtonPacket.LEFT: # LEFT button pressed
pixels.fill(BLUE)
pixels.show()
time.sleep(1)
elif packet.button == ButtonPacket.UP: # UP button pressed
pixels.fill(GREEN)
pixels.show()
time.sleep(1)
elif packet.button == ButtonPacket.DOWN: # DOWN button pressed
pixels.fill(WHITE)
pixels.show()
time.sleep(1) # Write your code here :-)
2023-05-31 11:18:05,625 - mu.logic:912(restore_session) INFO: Loaded files.
2023-05-31 11:18:05,625 - mu.logic:918(restore_session) INFO: User defined environment variables: {}
2023-05-31 11:18:05,625 - mu.logic:923(restore_session) INFO: Minify scripts on micro:bit? False
2023-05-31 11:18:05,679 - mu.modes.base:61(get_default_workspace) INFO: Using workspace /Users/judsonbelmont/mu_code from settings file
2023-05-31 11:18:05,696 - mu.interface.main:1047(show_message) DEBUG: Could not find an attached CircuitPython device.
2023-05-31 11:18:05,696 - mu.interface.main:1048(show_message) DEBUG: Python files for CircuitPython devices are stored on the device. Therefore, to edit these files you need to have the device plugged in. Until you plug in a device, Mu will use the directory found here:
/Users/judsonbelmont/mu_code
...to store your code.
2023-05-31 11:18:29,778 - mu.logic:1583(change_mode) INFO: Workspace directory: /Users/judsonbelmont/mu_code
2023-05-31 11:33:43,765 - mu.modes.base:61(get_default_workspace) INFO: Using workspace /Users/judsonbelmont/mu_code from settings file
2023-05-31 11:33:43,766 - mu.logic:1152(get_dialog_directory) INFO: Using path for file dialog: /Users/judsonbelmont/mu_code
2023-05-31 11:38:41,581 - mu.interface.main:416(get_load_path) DEBUG: Getting load path:
2023-05-31 11:38:43,992 - mu.modes.base:61(get_default_workspace) INFO: Using workspace /Users/judsonbelmont/mu_code from settings file
2023-05-31 11:38:43,993 - mu.logic:1152(get_dialog_directory) INFO: Using path for file dialog: /Users/judsonbelmont/mu_code
2023-05-31 11:38:50,276 - mu.interface.main:416(get_load_path) DEBUG: Getting load path: /Users/judsonbelmont/mu_code/Codes/code.py
2023-05-31 11:38:50,276 - mu.logic:1015(_load) INFO: Loading script from: /Users/judsonbelmont/mu_code/Codes/code.py
2023-05-31 11:38:50,277 - mu.logic:332(read_and_decode) DEBUG: Trying to decode with utf-8
2023-05-31 11:38:50,277 - mu.logic:335(read_and_decode) INFO: Decoded with utf-8
2023-05-31 11:38:50,278 - mu.logic:348(read_and_decode) DEBUG: Detected newline '\n'
2023-05-31 11:38:50,278 - mu.logic:1114(_load) DEBUG: from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
from adafruit_bluefruit_connect.packet import Packet
from adafruit_bluefruit_connect.accelerometer_packet import AccelerometerPacket
from adafruit_bluefruit_connect.magnetometer_packet import MagnetometerPacket
from adafruit_bluefruit_connect.gyro_packet import GyroPacket
from adafruit_bluefruit_connect.quaternion_packet import QuaternionPacket
from adafruit_bluefruit_connect.button_packet import ButtonPacket
import time
import board
import pulseio
import neopixel
import simpleio
import busio
import terminalio
from digitalio import DigitalInOut, Direction, Pull
from adafruit_display_text import label
import adafruit_displayio_ssd1306
import displayio
Display
displayio.release_displays()
Initialize i2c bus
i2c = busio.I2C(board.SCL, board.SDA)
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)
oled_text = "Robot Ready!"
def drawText(text):
# Write text on display
global display
# Make the display context
splash = displayio.Group(max_size=10)
display.show(splash)
color_bitmap = displayio.Bitmap(128, 32, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0x000000 # Black
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
splash.append(bg_sprite)
text_area_1 = label.Label(terminalio.FONT, text=oled_text, color=0xFFFF00, x=30, y=15)
splash.append(text_area_1)
pixel_pin = board.D12 #Pin that the NEOPIXELS are attached to.
num_pixels = 4
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.3, auto_write=False)
RED = (255, 0, 0)
YELLOW = (255, 150, 0)
GREEN = (0, 255, 0)
CYAN = (0, 255, 255)
BLUE = (0, 0, 255)
PURPLE = (180, 0, 255)
WHITE = (255, 255, 255)
def color_chase(color, wait):
for i in range(num_pixels):
pixels[i] = color
time.sleep(wait)
pixels.show()
time.sleep(0.5)
Define pin connected to piezo buzzer.
PIEZO_PIN = board.D11
Define a list of tones/music notes to play on the buzzer.
TONE_FREQ = [ 262, # C4
294, # D4
330, # E4
349, # F4
392, # G4
440, # A4
494 ] # B4
#motor pin definitions
motor1A = DigitalInOut(board.D5)
motor1B = DigitalInOut(board.D6)
motor2A = DigitalInOut(board.D9)
motor2B = DigitalInOut(board.D10)
motor1A.direction = Direction.OUTPUT
motor1B.direction = Direction.OUTPUT
motor2A.direction = Direction.OUTPUT
motor2B.direction = Direction.OUTPUT
ble = BLERadio()
uart = UARTService()
advertisement = ProvideServicesAdvertisement(uart)
while True:
drawText("") #Robot ready splash
pixels.fill(BLUE)
pixels.show()
ble.start_advertising(advertisement)
while not ble.connected:
pass
# Now we're connected
while ble.connected:
if uart.in_waiting:
packet = Packet.from_stream(uart)
if isinstance(packet, ButtonPacket) and packet.pressed:
if packet.button == ButtonPacket.RIGHT: #RIGHT
pixels.fill(BLUE)
pixels.show()
simpleio.tone(PIEZO_PIN, TONE_FREQ[5], duration=0.05)
simpleio.tone(PIEZO_PIN, TONE_FREQ[4], duration=0.1)
simpleio.tone(PIEZO_PIN, TONE_FREQ[0], duration=0.05)
motor1A.value = False
motor1B.value = True
motor2A.value = False
motor2B.value = True
elif packet.button == ButtonPacket.LEFT: # LEFT
pixels.fill(YELLOW)
pixels.show()
simpleio.tone(PIEZO_PIN, TONE_FREQ[6], duration=0.05)
simpleio.tone(PIEZO_PIN, TONE_FREQ[5], duration=0.1)
simpleio.tone(PIEZO_PIN, TONE_FREQ[0], duration=0.05)
motor1A.value = True
motor1B.value = False
motor2A.value = True
motor2B.value = False
elif packet.button == ButtonPacket.UP: # FORWARD
pixels.fill(GREEN)
pixels.show()
simpleio.tone(PIEZO_PIN, TONE_FREQ[2], duration=0.1)
motor1A.value = False
motor1B.value = True
motor2A.value = True
motor2B.value = False
elif packet.button == ButtonPacket.DOWN: # REVERSE
pixels.fill(RED)
pixels.show()
simpleio.tone(PIEZO_PIN, TONE_FREQ[3], duration=0.1)
motor1A.value = True
motor1B.value = False
motor2A.value = False
motor2B.value = True
elif packet.button == ButtonPacket.BUTTON_1: # button 1
pixels.fill(YELLOW)
pixels.show()
simpleio.tone(PIEZO_PIN, TONE_FREQ[6], duration=0.2)
simpleio.tone(PIEZO_PIN, TONE_FREQ[3], duration=0.1)
simpleio.tone(PIEZO_PIN, TONE_FREQ[0], duration=0.4)
print("released button 1")
elif packet.button == ButtonPacket.BUTTON_2: # button 2
pixels.fill(RED)
pixels.show()
simpleio.tone(PIEZO_PIN, TONE_FREQ[0], duration=0.2)
simpleio.tone(PIEZO_PIN, TONE_FREQ[3], duration=0.1)
simpleio.tone(PIEZO_PIN, TONE_FREQ[6], duration=0.4)
print("released button 2")
elif packet.button == ButtonPacket.BUTTON_3: # button 3
pixels.fill(BLUE)
pixels.show()
print("released button 3")
elif packet.button == ButtonPacket.BUTTON_4: # button 4
pixels.fill(CYAN)
pixels.show()
print("released button 4")
else:
pixels.fill(WHITE)
pixels.show()
print("stopped")
drawText("") #Robot ready splash
motor1A.value = False
motor1B.value = False
motor2A.value = False
motor2B.value = False
elif isinstance(packet, ButtonPacket) and not packet.pressed:
if packet.button == ButtonPacket.RIGHT:
print("released right")
motor1A.value = False
motor1B.value = False
motor2A.value = False
motor2B.value = False
if packet.button == ButtonPacket.LEFT:
print("released left")
motor1A.value = False
motor1B.value = False
motor2A.value = False
motor2B.value = False
if packet.button == ButtonPacket.UP:
print("released forward")
motor1A.value = False
motor1B.value = False
motor2A.value = False
motor2B.value = False
if packet.button == ButtonPacket.DOWN:
print("released reverse")
motor1A.value = False
motor1B.value = False
motor2A.value = False
motor2B.value = False
2023-05-31 11:38:57,799 - mu.logic:1152(get_dialog_directory) INFO: Using path for file dialog: /Users/judsonbelmont/mu_code/Codes
2023-05-31 11:39:00,658 - mu.interface.main:416(get_load_path) DEBUG: Getting load path: /Users/judsonbelmont/mu_code/Codes/code.py
2023-05-31 11:39:00,658 - mu.logic:1015(_load) INFO: Loading script from: /Users/judsonbelmont/mu_code/Codes/code.py
2023-05-31 11:39:00,659 - mu.logic:1043(_load) INFO: Script already open.
2023-05-31 11:39:00,671 - mu.interface.main:1047(show_message) DEBUG: The file "code.py" is already open.
2023-05-31 11:39:00,671 - mu.interface.main:1048(show_message) DEBUG: None
2023-05-31 11:40:21,432 - mu.logic:1530(select_mode) INFO: Showing available modes: ['python', 'snek', 'circuitpython', 'microbit', 'esp', 'web', 'pyboard', 'debugger', 'pygamezero', 'lego', 'pico']
2023-05-31 11:47:47,123 - mu.interface.main:1047(show_message) DEBUG: Could not find an attached device.
2023-05-31 11:47:47,124 - mu.interface.main:1048(show_message) DEBUG: Please make sure the device is plugged into this computer.
It must have a version of MicroPython (or CircuitPython) flashed onto it before the REPL will work.
Finally, press the device's reset button and wait a few seconds before trying again.
2023-05-31 11:48:00,816 - mu.modes.base:481(toggle_repl) INFO: Toggle REPL on.
2023-05-31 12:00:32,653 - mu.logic:1530(select_mode) INFO: Showing available modes: ['python', 'snek', 'circuitpython', 'microbit', 'esp', 'web', 'pyboard', 'debugger', 'pygamezero', 'lego', 'pico']
2023-05-31 12:00:56,269 - mu.logic:1319(zoom_in) INFO: Zoom in
2023-05-31 12:00:58,018 - mu.logic:1326(zoom_out) INFO: Zoom out
2023-05-31 12:00:59,618 - mu.logic:992(toggle_theme) INFO: Toggle theme to: night
2023-05-31 12:01:01,735 - mu.logic:992(toggle_theme) INFO: Toggle theme to: contrast
2023-05-31 12:01:02,719 - mu.logic:992(toggle_theme) INFO: Toggle theme to: day
2023-05-31 12:01:21,753 - mu.logic:1439(show_admin) INFO: Showing admin with logs from /Users/judsonbelmont/Library/Logs/mu/mu.log
2023-05-31 12:01:21,753 - mu.virtual_environment:984(installed_packages) INFO: Discovering installed third party modules in venv.
2023-05-31 12:01:21,756 - mu.virtual_environment:139(run_blocking) INFO: About to run blocking /Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/pip with args ['list', '--disable-pip-version-check'] and envvars {}
2023-05-31 12:01:22,469 - mu.virtual_environment:189(wait) DEBUG: Finished: True; exitStatus 0; exitCode 0
2023-05-31 12:01:22,470 - mu.virtual_environment:274(run) DEBUG: Process output: Package Version
appnope 0.1.3
asttokens 2.1.0
backcall 0.2.0
click 8.1.3
decorator 5.1.1
entrypoints 0.4
executing 1.2.0
Flask 2.0.3
ipykernel 5.5.6
ipython 8.6.0
ipython-genutils 0.2.0
itsdangerous 2.1.2
jedi 0.18.1
Jinja2 3.1.2
jupyter_client 7.4.5
jupyter_core 5.0.0
MarkupSafe 2.1.1
matplotlib-inline 0.1.6
nest-asyncio 1.5.6
numpy 1.23.4
parso 0.8.3
pexpect 4.8.0
pgzero 1.2.1
pickleshare 0.7.5
pip 22.3.1
platformdirs 2.5.4
prompt-toolkit 3.0.32
ptyprocess 0.7.0
pure-eval 0.2.2
pygame 2.1.2
Pygments 2.13.0
python-dateutil 2.8.2
pyzmq 24.0.1
setuptools 65.5.1
six 1.16.0
stack-data 0.6.1
tornado 6.2
traitlets 5.5.0
wcwidth 0.2.5
Werkzeug 2.2.2
wheel 0.38.4
2023-05-31 12:01:22,470 - mu.virtual_environment:993(installed_packages) INFO: []
2023-05-31 12:02:58,017 - mu.logic:1382(show_help) INFO: Showing help at 'https://codewith.mu/en/help/1.2'.
2023-05-31 12:04:16,871 - mu.logic:1382(show_help) INFO: Showing help at 'https://codewith.mu/en/help/1.2'.
2023-05-31 12:04:46,767 - mu.logic:1439(show_admin) INFO: Showing admin with logs from /Users/judsonbelmont/Library/Logs/mu/mu.log
2023-05-31 12:04:46,768 - mu.virtual_environment:984(installed_packages) INFO: Discovering installed third party modules in venv.
2023-05-31 12:04:46,769 - mu.virtual_environment:139(run_blocking) INFO: About to run blocking /Users/judsonbelmont/Library/Application Support/mu/mu_venv-38-20230510-110104/bin/pip with args ['list', '--disable-pip-version-check'] and envvars {}
2023-05-31 12:04:47,198 - mu.virtual_environment:189(wait) DEBUG: Finished: True; exitStatus 0; exitCode 0
2023-05-31 12:04:47,199 - mu.virtual_environment:274(run) DEBUG: Process output: Package Version
appnope 0.1.3
asttokens 2.1.0
backcall 0.2.0
click 8.1.3
decorator 5.1.1
entrypoints 0.4
executing 1.2.0
Flask 2.0.3
ipykernel 5.5.6
ipython 8.6.0
ipython-genutils 0.2.0
itsdangerous 2.1.2
jedi 0.18.1
Jinja2 3.1.2
jupyter_client 7.4.5
jupyter_core 5.0.0
MarkupSafe 2.1.1
matplotlib-inline 0.1.6
nest-asyncio 1.5.6
numpy 1.23.4
parso 0.8.3
pexpect 4.8.0
pgzero 1.2.1
pickleshare 0.7.5
pip 22.3.1
platformdirs 2.5.4
prompt-toolkit 3.0.32
ptyprocess 0.7.0
pure-eval 0.2.2
pygame 2.1.2
Pygments 2.13.0
python-dateutil 2.8.2
pyzmq 24.0.1
setuptools 65.5.1
six 1.16.0
stack-data 0.6.1
tornado 6.2
traitlets 5.5.0
wcwidth 0.2.5
Werkzeug 2.2.2
wheel 0.38.4
2023-05-31 12:04:47,199 - mu.virtual_environment:993(installed_packages) INFO: []