Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an example with NeoPixel LED strip #164

Open
Lalle77 opened this issue Jan 12, 2021 · 1 comment
Open

Add an example with NeoPixel LED strip #164

Lalle77 opened this issue Jan 12, 2021 · 1 comment

Comments

@Lalle77
Copy link

Lalle77 commented Jan 12, 2021

I am quite new to Python programming and eager to learn more about it. Therefore, I have started a hobby project to rebuild a RC car and replace its electronics with a Raspberry PI Zero board and put a WS2812 / NeoPixel Addressable LEDs into it. I found the BlueDot app very suitable for this project and especially the code example for the Robot. I have tried to add an "elif" with additional code to be able to make the LED sling blink when I press the button in middle and stop when I push the button again (toggle function). But, since that part of code consist of a while(1) loop, I run into trouble, because of the endless loop. I have googled for possible solutions and what I have found is a solution with multiprocessing.
Would it be possible for you to add code to the robotics code to show an example how multiprocessing works and will be implemented?

The code I want to use to start the LED sling to blink is:

import board
import neopixel
import time
pixels = neopixel.NeoPixel(board.D18, 28)

while True:
if n<3:
pixels.fill((0,0,255))
time.sleep(0.05)
pixels.fill((0,0,0))
time.sleep(0.05)
n+=1
else:
n=0
time.sleep(0.2)

@martinohanlon
Copy link
Owner

I would encourage you to take your question to the raspberry pi forum raspberrypi.org/forum, there are lots of friendly people there who would be able to help.

I am the only person who monitors these issues and works on BlueDot and it will take me a while to look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants