lavallc / nrf51-neopixel Goto Github PK
View Code? Open in Web Editor NEWWS2812(Neopixel) library for the Nordic Semiconductor 51822 Bluetooth Low Energy ARM SoC.
License: MIT License
WS2812(Neopixel) library for the Nordic Semiconductor 51822 Bluetooth Low Energy ARM SoC.
License: MIT License
Hi there,
thank you very much for this library. We were hoping to use it in a project with a RBL nRF51822 and a small Neopixel ring, but all it does is turn on all of the LEDs and set them to white. No matter what configuration we tried, the Neopixel ring never showed the colour pattern that we set in code.
Can you give me some hints on how to debug this, or how to change your code to make it work?
Thanks!
Board reference: http://oshchip.org/
I'm attempting to get a single LED working on the OSHChip board with no Soft Device.
Code
#include "nrf_delay.h"
#include "nrf_gpio.h"
#include "boards.h"
#include "neopixel.h"
int leds[] = { LED_RED, LED_GREEN, LED_BLUE };
neopixel_strip_t m_strip;
uint8_t dig_pin_num = OSHChip_Pin_3;
uint8_t leds_per_strip = 1;
uint8_t error;
uint8_t led_to_enable = 0;
uint8_t red = 0;
uint8_t green = 255;
uint8_t blue = 0;
int main(void)
{
int i = 0;
for(; i < 3; i++) {
nrf_gpio_cfg_output(leds[i]);
nrf_gpio_pin_set(leds[i]);
}
i = 1;
neopixel_init(&m_strip, dig_pin_num, leds_per_strip);
neopixel_clear(&m_strip);
while(i++) {
error = neopixel_set_color_and_show(&m_strip, led_to_enable, red, i % 255, blue);
if(error) {
nrf_gpio_pin_clear(LED_RED);
} else {
nrf_gpio_pin_set(LED_RED);
}
nrf_delay_ms(500);
}
}
The result is a solid blue/red mix without any changes.
OSHChip_Pin_3
expands to 16
and I've verified signal on the pin.
Not sure what else to provide but I have noticed something interesting compared to the Adafruit NeoPixel library. Using that my scope shows a constant stream of ~8 bits in a span of about 30us
where as this library shows (I assume) ~24 over an 80us
period.
Presumably there is an assumption about the clock rate of the SoC and that's why.
Tested empirically (adjusting # of NOPs):
nRF51: 9,0,1,8
nRF52: 41,20, 20,41
This works ok for first LED on strip but cracks up after that. Not accurate enough.
On the 52 it may be possible to do this better with interrupts. Not tried yet.
Hello,
I am trying to get this to work with micro:bit, but it is behaving strange. The first time I update the pixels, they all show as they are supposed to, but every second time all of the pixels light up yellow-ish.
I have tried to play around with the number of NOPS, but that does not seem to work.
This is the code I am using towards the NeoPixels:
`for (uint16_t lampe = 0; lampe < 64; lampe++) {
neopixel_set_color(&m_strip, lampe, 10, 0, 0);
neopixel_show(&m_strip);
uBit.sleep(200);
}`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.