Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Circuit playground Bluefruit
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Circuit playground Bluefruit

by John_the_Bot on Wed Apr 22, 2020 8:16 pm

I am having trouble with updating my code.py file on my Circuitplayground Bluefruit. When I tried to open the existing code.py file, windows would say that there was a problem with the file and I had to run check disk on my drive. When I would actually do that, I was able to open the file that did not say print:helloworld like I think it said the first time I opened it. Instead it was a blank file. I would copy and paste this code from the tutorial I was reading:

Code: Select all | TOGGLE FULL SIZE
import board
import digitalio
import time
 
led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT
 
while True:
    led.value = True
    time.sleep(0.5)
    led.value = False
    time.sleep(0.5)


The code did not work. I would then tried deleting the code.py file and save a new one in it's place. The file would disappear, but when I made a new code.py, Windows would say that one already exists.

At the time I had updated the uf2 file]https://circuitpython.org/board/circuitplayground_bluefruit/ and imported libraries https://circuitpython.org/libraries.

Then I formatted the drive.

Now when I hit the reset button once in CIRCUITPY (D:) , the only thing that shows up is a text file called boot_out.

When I double tap the reset button CPLAYBTBOOT (D:), the three files CURRENT.UF2, INDEX, and INFO_UF2 show up.

I'm not sure what I can do to get it to run the code.py running. I think my circuitpy drive is missing some files, but I haven't been able to find them.

edit: closing statement

John_the_Bot
 
Posts: 3
Joined: Wed Apr 22, 2020 7:58 pm

Re: Circuit playground Bluefruit

by dastels on Wed Apr 22, 2020 9:11 pm

OK, you cleared out all the files. When CircuitPlayground first boots it updates the boot file.

You only need to double-tap reset and get the CPLAYBOOT device when you want to update CircuitPython (by copying the appropriate UF2 file to CPLAYBOOT. Once the copying is finished, CPLAYBOOT will unmount and CIRCUITPY will be mounted.

You need to put your code into CIRCUITPY/code.py and copy any libraries it needs into the CIRCUITPY/lib directory (which you will need to create initially).

All this is covered in the CircuitPython guide: https://learn.adafruit.com/welcome-to-circuitpython

Dave

dastels
 
Posts: 3781
Joined: Tue Oct 20, 2015 3:22 pm

Re: Circuit playground Bluefruit

by John_the_Bot on Fri Apr 24, 2020 7:34 pm

I have now done the following:

Double tapped the reset button to get the CPLAYBTBOOT drive to come up. Then I updated the u2 file.
Created a folder called lib in the CIRCUITPY drive as well as a file called code.py that I then copypasted the LED code in last post.
The board did not start blinking as I think it should, I then press the reset button once.
I open the code.py file and get a prompt saying "The file or directory /code.py.txt is corrupt and unreadable. Please run the Chkdsk utility."

This is my first project like this, so apologies if I'm missing something obvious.

edit: the code.py file did not look like a python file. It had a text icon. Not sure if that's worth mentioning.

John_the_Bot
 
Posts: 3
Joined: Wed Apr 22, 2020 7:58 pm

Re: Circuit playground Bluefruit

by dastels on Fri Apr 24, 2020 7:54 pm

I don't know how sensitive Windows is, but I have had problems occasionally from resetting or disconnecting without first ejecting the drive. Have a look at about half way down (section "CIRCUITPY Drive Issues") https://learn.adafruit.com/welcome-to-circuitpython/troubleshooting for information on how to reformat CIRCUITPY.

Dave

dastels
 
Posts: 3781
Joined: Tue Oct 20, 2015 3:22 pm

Re: Circuit playground Bluefruit

by dastels on Fri Apr 24, 2020 7:57 pm

That code should blink the D13 LED, half a second on, half a second off.

You could go into the REPL, do the imports, build the DigitalInOut, just like the code in the file does, then set led.value to True & False to see if the LED turns on & off.

That'll prove that things generally work.

Dave

dastels
 
Posts: 3781
Joined: Tue Oct 20, 2015 3:22 pm

Re: Circuit playground Bluefruit

by John_the_Bot on Fri Apr 24, 2020 8:33 pm

Formatting using MU and REPL was the answer. Thanks, Dave!

John_the_Bot
 
Posts: 3
Joined: Wed Apr 22, 2020 7:58 pm

Please be positive and constructive with your questions and comments.