B4R Library rAdafruitNeoPixel

Wrapper for this library: https://github.com/adafruit/Adafruit_NeoPixel
Library for controlling single-wire-based LED pixels and strip.

Example:
B4X:
Sub Process_Globals
   Public Serial1 As Serial
   Private pixel As AdafruitNeoPixel
   Private timer1 As Timer  
   Private n As Int
End Sub

Private Sub AppStart
   Serial1.Initialize(115200)
   Log("AppStart")
   pixel.Initialize(16, 6, pixel.NEO_GRB)
   timer1.Initialize("timer1_Tick", 500)
   timer1.Enabled = True
End Sub

Sub Timer1_Tick
   n = (n + 1) Mod 16
   pixel.SetPixelColor(n, 0, 150, 0)
   pixel.Show
End Sub
 

Attachments

  • rAdafruitNeoPixel.zip
    18 KB · Views: 682
Last edited:

Cableguy

Expert
Licensed User
Longtime User
It works just PERFECT!!! time to do some voodoo!!!!( meaning, tested with UNO, now testing with ESP)
 

Cableguy

Expert
Licensed User
Longtime User
VOODOO is working too!!!
(I mean, it works on ESP too!!)
 

Cableguy

Expert
Licensed User
Longtime User
I will implement some anims later today and post them... I just need to find some cool 5x8 pixel art!
 
Last edited:

Cableguy

Expert
Licensed User
Longtime User
well, not a cool 8x5 pixel art, but something to show...

I adapted the remote config example in order to show the "Wifi waves" when it enters AP mode.

here's my 8X5 neoPixel board:
NeoPixel-3-600x600.jpg
 
Last edited:

Robert Gately

Member
Licensed User
Nice! I had been away from B4R for several months and am glad to see two new libraries (this one and rNSRainbow) for use with WS2812B LEDs. Thanks! and thank you Cableguy too for your code. Now I need to build something.
 

Robert Gately

Member
Licensed User
With the rAdafruitNeoPixel library, it does not seem possible to change the color of all leds at once, unless I change them all individually using a For loop and then use Pixel.Show. Let's say I want all of the LEDs to Red. Is there a simpler way to do this than changing them individually in a loop? With Cableguy's WS2812 code module it is possible to change all LEDs at once by using "-1" instead of the individual LED number.

Thanks for any help!
 

Cableguy

Expert
Licensed User
Longtime User
No, arduino is a very very different platform.
You can however, use b4j to create a program to interact with the Arduino or an esp2866 board using serial or WiFi
 
Top