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: 830
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:

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!
 

Robert Gately

Member
Licensed User
You will need to use a for loop. It will be very fast.

Thanks.

I think I'll go with the rNSRainbow library. It seems to use a little less memory than the Adafruit NeoPixel library and allows me to use more than just one pin.
 

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
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…