Linux won't find CPB
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- danhalbert
- Posts: 4688
- Joined: Tue Aug 08, 2017 12:37 pm
Re: Linux won't find CPB
Are you saying that when you type ctrl-D, it says "code.py" output and then immediately finishes?
- Insert_Name_Here
- Posts: 64
- Joined: Tue Dec 07, 2021 2:35 pm
Re: Linux won't find CPB
I think so.
- danhalbert
- Posts: 4688
- Joined: Tue Aug 08, 2017 12:37 pm
Re: Linux won't find CPB
That makes it sounds to me as if code.py is empty, or something like that. Could you make sure the code.py is as you wrote above, and put a bunch of print statements into code.py to see how far it gets?
- Insert_Name_Here
- Posts: 64
- Joined: Tue Dec 07, 2021 2:35 pm
Re: Linux won't find CPB
Code: Select all
import supervisor
from adafruit_circuitplayground import cp
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.standard.hid import HIDService
from adafruit_hid.mouse import Mouse
print("finished import")
supervisor.disable_ble_workflow()
print("disable ble workflow(whatever that means)")
cp.pixels.brightness = 0.1
cp.pixels.fill((0, 0, 0))
ble = BLERadio()
ble.name = "Circuit Playground BLE"
hid = HIDService()
advertisement = ProvideServicesAdvertisement(hid)
mouse = Mouse(hid.devices)
print("entering while loop")
while True:
ble.start_advertising(advertisement)
cp.pixels.fill((0, 50, 50))
while not ble.connected:
pass
print("connected")
while ble.connected:
cp.pixels.fill((0, 50, 0))
while cp.button_a:
mouse.click(Mouse.LEFT_BUTTON)
while cp.button_b:
mouse.click(Mouse.RIGHT_BUTTON)
Also, code.py is not empty.
- danhalbert
- Posts: 4688
- Joined: Tue Aug 08, 2017 12:37 pm
Re: Linux won't find CPB
If you go to the console, and then type ctrl-C, does it interrupt the program and print something? If so, what?
Is there absolutely nothing in the console? This is the Mu console, right?
Is there absolutely nothing in the console? This is the Mu console, right?
- danhalbert
- Posts: 4688
- Joined: Tue Aug 08, 2017 12:37 pm
Re: Linux won't find CPB
It occurs to me this might be a /dev/tty* permissions problem. You need to add yourself to the group that those devices are in:
https://learn.adafruit.com/welcome-to-c ... 3027345-11 (dialout group, used on Ubuntu)
https://learn.adafruit.com/welcome-to-c ... 2978572-10 (more general)
https://learn.adafruit.com/welcome-to-c ... 3027345-11 (dialout group, used on Ubuntu)
https://learn.adafruit.com/welcome-to-c ... 2978572-10 (more general)
- Insert_Name_Here
- Posts: 64
- Joined: Tue Dec 07, 2021 2:35 pm
Re: Linux won't find CPB
I am not an Admin on the computer I use. If an Admin account ran that it would add the admin account to the group because of using $USER. What do I do? Replace $USER with my username? (I don't know much about BASH sorry)
- danhalbert
- Posts: 4688
- Joined: Tue Aug 08, 2017 12:37 pm
Re: Linux won't find CPB
Yes, $USER is the current user, so substitute your username.
Please be positive and constructive with your questions and comments.