Hello,
I originally posted this on the General forum, but I think it fits better here....
I am attempting to use the micro:bit with Arduino-cli. I have version 0.8 installed (of Arduino-cli), and I have gotten the basic compilation and uploading working. However, I am having some difficulty with a few things.
I am trying to drive NeoPixels, using the Adafruit library. This is working OK, but only on pins P0 through P4. On any of the other pins, nothing is happening.
Also, if I attempt to use the Adafruit_microbit library, I need to specify Softdevice=s110. This will let me compile, but now the Neopixels won't work at all, on any pin.
Have anyone gotten this to work as it is supposed to?
This is the code I am using for testing:
#include <Adafruit_NeoPixel.h>
const int numPixels = 6;
const int pixelPin = 1;
Adafruit_NeoPixel ring = Adafruit_NeoPixel(numPixels, pixelPin);
uint32_t foreground = ring.Color(50,0,60); // r, g, b - blue
uint32_t background = ring.Color(0, 50, 0); // dim white
void setup() {
pinMode(pixelPin, OUTPUT);
ring.begin(); // start the NeoPixel display
}
void loop() {
// blue dot circles around a white background (for PixelRing 24)
for (int i = 0; i < numPixels; i++) {
ring.setPixelColor(i, foreground); // set pixel i to foreground
ring.show(); // actually display it
delay(50); // milliseconds
ring.setPixelColor(i, background); // set pixel to background before moving on
ring.show();
}
}
And the command line I have been attempting:
arduino-cli compile --fqbn sandeepmistry:nRF5:BBCmicrobit; cp mbnptest.sandeepmistry.nRF5.BBCmicrobit.hex /Volumes/MICROBIT/
arduino-cli compile --fqbn sandeepmistry:nRF5:BBCmicrobit:softdevice=s110; cp mbnptest.sandeepmistry.nRF5.BBCmicrobit.hex /Volumes/MICROBIT/