I've got a Neopixel Ring (12 LEDs), and two Pucks. I know they run on different voltages, so I've connected the Neopixel to a 5v USB supply, and used an opto-isolator to drive the data pin at 5v from the Puck.
I can't figure out how to make it work, though.
I've cobbled this together from various posts that I've found, but I assume I'm doing something wrong (or the Puck can't do the data rate I need perhaps?):
const PIN = D30;
const LEDS = 3;
function main() {
pinMode(PIN, 'output');
// I'm using 400000 here because I read they need a 4- or 8kHz stream, but no dice.
SPI1.setup({ baud: 400000, mosi: PIN });
let arr = new Uint8ClampedArray(3 * LEDS);
let idx = 0;
for (let i = 0; i < LEDS; ++i) {
arr[idx++] = 255;
arr[idx++] = 0;
arr[idx++] = 0;
}
console.log(arr);
SPI1.send4bit(arr, 0b0001, 0b0011);
}
main();
I've confirmed that the isolator can do upwards of 50kHz, and that it's working (by using a plain LED and setting D30 high – it lights from the 5v rail).
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I've got a Neopixel Ring (12 LEDs), and two Pucks. I know they run on different voltages, so I've connected the Neopixel to a 5v USB supply, and used an opto-isolator to drive the data pin at 5v from the Puck.
I can't figure out how to make it work, though.
I've cobbled this together from various posts that I've found, but I assume I'm doing something wrong (or the Puck can't do the data rate I need perhaps?):
I've confirmed that the isolator can do upwards of 50kHz, and that it's working (by using a plain LED and setting D30 high – it lights from the 5v rail).
Help! Thanks in advance.