Linux won't find CPB

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
danhalbert
 
Posts: 4613
Joined: Tue Aug 08, 2017 12:37 pm

Re: Linux won't find CPB

Post by danhalbert »

Are you saying that when you type ctrl-D, it says "code.py" output and then immediately finishes?

User avatar
Insert_Name_Here
 
Posts: 64
Joined: Tue Dec 07, 2021 2:35 pm

Re: Linux won't find CPB

Post by Insert_Name_Here »

I think so.

User avatar
danhalbert
 
Posts: 4613
Joined: Tue Aug 08, 2017 12:37 pm

Re: Linux won't find CPB

Post by danhalbert »

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?

User avatar
Insert_Name_Here
 
Posts: 64
Joined: Tue Dec 07, 2021 2:35 pm

Re: Linux won't find CPB

Post by Insert_Name_Here »

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)
I changed it to this. It doesn't print anything in the console.
Also, code.py is not empty.

User avatar
danhalbert
 
Posts: 4613
Joined: Tue Aug 08, 2017 12:37 pm

Re: Linux won't find CPB

Post by danhalbert »

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?

User avatar
danhalbert
 
Posts: 4613
Joined: Tue Aug 08, 2017 12:37 pm

Re: Linux won't find CPB

Post by danhalbert »

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)

User avatar
Insert_Name_Here
 
Posts: 64
Joined: Tue Dec 07, 2021 2:35 pm

Re: Linux won't find CPB

Post by Insert_Name_Here »

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)

User avatar
danhalbert
 
Posts: 4613
Joined: Tue Aug 08, 2017 12:37 pm

Re: Linux won't find CPB

Post by danhalbert »

Yes, $USER is the current user, so substitute your username.

Locked
Please be positive and constructive with your questions and comments.

Return to “Wireless: WiFi and Bluetooth”