CircuitPython NeoPixel Color Picker Example

Play with it! Please tell us which board you're using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
usmarine0622
 
Posts: 4
Joined: Sat Oct 26, 2019 1:07 am

CircuitPython NeoPixel Color Picker Example

Post by usmarine0622 »

When I run the code in the CircuitPython NeoPixel Color Picker Example I keep getting the error shown below. I followed the instrctions and have all the libs but I keep getting that error. I also posed the code I'm using below. I'm using the Circuit Playground Bluefruit - ALPHA - Bluetooth Low Energy

File "code.py", line 11, in <module>
TypeError: function missing required positional argument #3

* Code I'm using*

# CircuitPython NeoPixel Color Picker Example

import board
import neopixel
from adafruit_ble.uart_server import UARTServer
from adafruit_bluefruit_connect.packet import Packet
from adafruit_bluefruit_connect.color_packet import ColorPacket

uart_server = UARTServer()

pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.1)

while True:
# Advertise when not connected.
uart_server.start_advertising()
while not uart_server.connected:
pass

while uart_server.connected:
packet = Packet.from_stream(uart_server)
if isinstance(packet, ColorPacket):
print(packet.color)
pixels.fill(packet.color)

User avatar
V2man
 
Posts: 704
Joined: Mon Dec 03, 2018 12:38 am

Re: CircuitPython NeoPixel Color Picker Example

Post by V2man »


User avatar
V2man
 
Posts: 704
Joined: Mon Dec 03, 2018 12:38 am

Re: CircuitPython NeoPixel Color Picker Example

Post by V2man »

Your code will be more readable if you use the code tab above and insert your code in between. This is what the original ble_color_picker.py looks like:

Code: Select all

# CircuitPython NeoPixel Color Picker Example

import board
import neopixel
from adafruit_ble.uart_server import UARTServer
from adafruit_bluefruit_connect.packet import Packet
from adafruit_bluefruit_connect.color_packet import ColorPacket

uart_server = UARTServer()

pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.1)

while True:
    # Advertise when not connected.
    uart_server.start_advertising()
    while not uart_server.connected:
        pass

    while uart_server.connected:
        packet = Packet.from_stream(uart_server)
        if isinstance(packet, ColorPacket):
            print(packet.color)
            pixels.fill(packet.color)

User avatar
usmarine0622
 
Posts: 4
Joined: Sat Oct 26, 2019 1:07 am

Re: CircuitPython NeoPixel Color Picker Example

Post by usmarine0622 »

V2man wrote:See this post viewtopic.php?f=58&t=157616
I followed everything In that post and still have the error.

User avatar
V2man
 
Posts: 704
Joined: Mon Dec 03, 2018 12:38 am

Re: CircuitPython NeoPixel Color Picker Example

Post by V2man »

You got the adafruit_ble folder to copy to CIRCUITPY/lib from https://github.com/adafruit/Adafruit_Ci ... .1-alpha.2 ? Not from the bundle CircuitPython 5.0.0-alpha.4.
What are the contents of your CIRCUITPY/boot_out.txt?
Are you using MU editor with mode set to Adafruit Circuit Python?

User avatar
usmarine0622
 
Posts: 4
Joined: Sat Oct 26, 2019 1:07 am

Re: CircuitPython NeoPixel Color Picker Example

Post by usmarine0622 »

V2man wrote:You got the adafruit_ble folder to copy to CIRCUITPY/lib from https://github.com/adafruit/Adafruit_Ci ... .1-alpha.2 ? Not from the bundle CircuitPython 5.0.0-alpha.4.
What are the contents of your CIRCUITPY/boot_out.txt?
Are you using MU editor with mode set to Adafruit Circuit Python?
You got the adafruit_ble folder to copy to CIRCUITPY/lib from https://github.com/adafruit/Adafruit_Ci ... .1-alpha.2 ? Not from the bundle CircuitPython 5.0.0-alpha.4.
Yes

Are you using MU editor with mode set to Adafruit Circuit Python?
Yes

What are the contents of your CIRCUITPY/boot_out.txt?

Adafruit CircuitPython 5.0.0-alpha.4 on 2019-09-15; Adafruit Circuit Playground Bluefruit with nRF52840

User avatar
V2man
 
Posts: 704
Joined: Mon Dec 03, 2018 12:38 am

Re: CircuitPython NeoPixel Color Picker Example

Post by V2man »

What does Check in MU say?
You are sure you are using the code.py file from the CIRCUITPY drive in MU?
Do want to try the latest experimental uf2s?
This is what I am running on my CPB.
Download adafruit-circuitpython-circuitplayground_bluefruit-en_US-20191024-9d7b984.uf2 from https://adafruit-circuit-python.s3.amaz ... uit/en_US/
Press reset twice on the CPB to get CPLAYBTBOOT drive.
Copy the uf2 you just downloaded to the CPLAYBTBOOT drive.
Now what happens?

User avatar
usmarine0622
 
Posts: 4
Joined: Sat Oct 26, 2019 1:07 am

Re: CircuitPython NeoPixel Color Picker Example

Post by usmarine0622 »

V2man wrote:You got the adafruit_ble folder to copy to CIRCUITPY/lib from https://github.com/adafruit/Adafruit_Ci ... .1-alpha.2 ? Not from the bundle CircuitPython 5.0.0-alpha.4.
What are the contents of your CIRCUITPY/boot_out.txt?
Are you using MU editor with mode set to Adafruit Circuit Python?
I have it working now, I removed each lib and added them back one at a time while watching the output. It looks like the neopixel lib file was causing the problem, I replaced it with a fresh download and it's working. I appreciate your time in looking into this with me, this is my first time using one of these.

User avatar
V2man
 
Posts: 704
Joined: Mon Dec 03, 2018 12:38 am

Re: CircuitPython NeoPixel Color Picker Example

Post by V2man »

Great. Success that's what I like to hear!
With Alpha product you have to remember the libraries are changing everyday.

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

Return to “Circuit Playground Classic, Circuit Playground Express, Circuit Playground Bluefruit”