Due to high demand, expect some shipping delays at this time - orders may not ship for up to 2-3 business days.
0

Linux won't find CPB
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Linux won't find CPB

by danhalbert on Mon Dec 27, 2021 6:42 pm

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

danhalbert
 
Posts: 3182
Joined: Tue Aug 08, 2017 12:37 pm

Re: Linux won't find CPB

by Insert_Name_Here on Wed Dec 29, 2021 3:58 am

I think so.

Insert_Name_Here
 
Posts: 58
Joined: Tue Dec 07, 2021 2:35 pm

Re: Linux won't find CPB

by danhalbert on Wed Dec 29, 2021 9:43 am

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?

danhalbert
 
Posts: 3182
Joined: Tue Aug 08, 2017 12:37 pm

Re: Linux won't find CPB

by Insert_Name_Here on Sun Jan 02, 2022 8:02 pm

Code: Select all | TOGGLE FULL SIZE
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.

Insert_Name_Here
 
Posts: 58
Joined: Tue Dec 07, 2021 2:35 pm

Re: Linux won't find CPB

by danhalbert on Sun Jan 02, 2022 8:29 pm

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?

danhalbert
 
Posts: 3182
Joined: Tue Aug 08, 2017 12:37 pm

Re: Linux won't find CPB

by danhalbert on Sun Jan 02, 2022 9:18 pm

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)

danhalbert
 
Posts: 3182
Joined: Tue Aug 08, 2017 12:37 pm

Re: Linux won't find CPB

by Insert_Name_Here on Sun Jan 16, 2022 9:38 pm

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)

Insert_Name_Here
 
Posts: 58
Joined: Tue Dec 07, 2021 2:35 pm

Re: Linux won't find CPB

by danhalbert on Sun Jan 16, 2022 9:41 pm

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

danhalbert
 
Posts: 3182
Joined: Tue Aug 08, 2017 12:37 pm

Please be positive and constructive with your questions and comments.