BIPES / BIPES

BIPES: Block based Integrated Platform for Embedded Systems allows text and block based programming for several types of embedded systems and Internet of Things modules using MicroPython, CircuitPython, Python or Snek. You can connect, program, debug and monitor several types of boards using network, USB or Bluetooth. No software install needed!
https://bipes.net.br/ide
GNU General Public License v3.0
143 stars 69 forks source link

Feature request - import neopixel - and custom Neopixel Display block #19

Closed ptal78 closed 3 years ago

ptal78 commented 3 years ago

Neopixel (ws2812) LED RGB strip lights protocol is already included in micropython for multicolored displays.

Example user code:

import machine, neopixel np = neopixel.NeoPixel(machine.Pin(19), 16)

np[0] = (255, 0, 0) # set LED 0 to red, full brightness np[1] = (0, 128, 0) # set LED 1 to green, half brightness np[2] = (0, 0, 64) # set LED 2 to blue, quarter brightness

These could be easily configured with three blocks

If you need more thoughts about this let me know.

ptal78 commented 3 years ago

Oh, I forgot the following:

np.write() # required to transmit the data from the buffer array to the LEDs

Also, if you would like an example of the code, the following implementation is much preferred than the older ESP8266 documentation does it (and should still work for both).

ESP32: https://docs.micropython.org/en/latest/esp32/quickref.html?highlight=esp32%20neopixel

This also has an explanation of the APA106 driver, and the Touchpad driver.

rafaelaroca commented 3 years ago

Hello! Done, but not tested. Took the opportunity to write about how to create new blocks: https://bipes.net.br/wp/creating-new-blocks/

Example: https://bipes.net.br/beta2serial/ui/#i3dbcf

Could you test it please?

Only implemented in the beta2serial. If it works, we can copy the code to WebRPL (network version)

best regards! Rafael

ptal78 commented 3 years ago

Excellent - it works great! You are a champion.

rafaelaroca commented 3 years ago

:-)

lbaitemple commented 1 year ago

:-)

c

Hello! Done, but not tested. Took the opportunity to write about how to create new blocks: https://bipes.net.br/wp/creating-new-blocks/

Example: https://bipes.net.br/beta2serial/ui/#i3dbcf

Could you test it please?

Only implemented in the beta2serial. If it works, we can copy the code to WebRPL (network version)

best regards! Rafael

Can you make the neopixel work in raspberry pi pico? I tried on offline version, but I cannot include the neopixel library.

jetannenbaum commented 1 year ago

The offline version has been updated to use the internal MicroPython neopixel library for the Pico. You need to use version 1.18 or later of the MicroPython firmware. Available here: https://micropython.org/download/rp2-pico/

lbaitemple commented 1 year ago

Thanks. I tried that, but the code does not run. The follow error appears in the console as AttributeError: 'module' object has no attribute 'NeoPixel'

I think the problem is the NeoPixel was declared incorrectly in the code. I guess we cannot use the block code to control the NeoPixel.

jetannenbaum commented 1 year ago

Hi,

I'm a bit confused. I tried the neopixel blocks in both the "standard" bipes code (http://bipes.net.br/ide/) and a branch that is specific to the RP2040 boards (https://bipes.net.br/pico/ui/). In both cases, the neopixel blocks ran without error. I then attempted to run the downloaded code from https://bipes.net.br/wp/ That version of code didn't have the capability to use a neopixel display with the Pico. Finally, I tried the code from the offline branch. Once I built the index_offline file and tried the neopixel block, it ran fine. Can you supply a few more details on which code you were running? Thanks

lbaitemple commented 1 year ago

Hi,

I'm a bit confused. I tried the neopixel blocks in both the "standard" bipes code (http://bipes.net.br/ide/) and a branch that is specific to the RP2040 boards (https://bipes.net.br/pico/ui/). In both cases, the neopixel blocks ran without error. I then attempted to run the downloaded code from https://bipes.net.br/wp/ That version of code didn't have the capability to use a neopixel display with the Pico. Finally, I tried the code from the offline branch. Once I built the index_offline file and tried the neopixel block, it ran fine. Can you supply a few more details on which code you were running? Thanks

Thank you. I figured it out. I was using a wrong neopixel python file (https://github.com/blaz-r/pi_pico_neopixel/blob/main/neopixel.py). I uploaded micropython neopixel python file. It runs without any error, but I would hope we can change the brightness of the neopixel display. Thank you again for your quick response.

zegonix commented 1 year ago

Hi, I tried to use the NeoPixel library with my Raspberry Pi Pico. I noticed, that the blocks are not listed when working with the Pico, but are when working with the ESP32. I tried to generate a little test program for the ESP32 and then switch to the Pico, but I can't test it, as it doesn't connect (I use Chrome with 'experimental wep platform features' enabled). The website doesn't support https and this article says that the web terminal only work with https, so maybe this is the problem? I will try it offline, but since we plan to use this in a workshop with kids, the offline version would be a dealbreaker for us.