adafruit / Adafruit_NeoPixel

Arduino library for controlling single-wire LED pixels (NeoPixel, WS2812, etc.)
GNU Lesser General Public License v3.0
3.12k stars 1.27k forks source link

Library porting for Arduino Nicla Sense ME #319

Open sapienshawk opened 2 years ago

sapienshawk commented 2 years ago

Hereafter the complete error message I get when try to compile Neopixel Library with Nicla Sense ME Arduino: 1.8.19 (Windows 10), Board: "Nicla Sense ME"

C:\Users\sapie\OneDrive\Documenti\Arduino\libraries\Adafruit_NeoPixel\Adafruit_NeoPixel.cpp: In member function 'void Adafruit_NeoPixel::show()':

C:\Users\sapie\OneDrive\Documenti\Arduino\libraries\Adafruit_NeoPixel\Adafruit_NeoPixel.cpp:2134:24: error: 'g_ADigitalPinMap' was not declared in this scope

pwm->PSEL.OUT[0] = g_ADigitalPinMap[pin];

^~~~

C:\Users\sapie\OneDrive\Documenti\Arduino\libraries\Adafruit_NeoPixel\Adafruit_NeoPixel.cpp:2187:24: error: 'digitalPinToBitMask' was not declared in this scope

uint32_t pinMask = digitalPinToBitMask(pin);

^~~~~~~

C:\Users\sapie\OneDrive\Documenti\Arduino\libraries\Adafruit_NeoPixel\Adafruit_NeoPixel.cpp:2187:24: note: suggested alternative: 'digitalPinToPinName'

uint32_t pinMask = digitalPinToBitMask(pin);

^~~~~~~

digitalPinToPinName

exit status 1

Error compiling for board Nicla Sense ME.

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

============================================

mikeysklar on Mon Mar 28, 2022 5:41 pm

The Nicla Sense is a nRF52832 (M4 core) board. It looks quite similar to the myNewt that Adafruit has been selling.

You can open an issue requesting support through the NeoPixel github library repo. It might be a matter of adding a board identifier and possibly some pin assignments. The NRF52 / NRF52840 board identifier is already in place in the library.

=============================== So many thanks for any help.. Regards

ladyada commented 2 years ago

we don't own this board, so we are happy to take a PR but we would not be adding it ourselves since we cannot test

sapienshawk commented 2 years ago

So many thank for you reply Ladyada (I'm your fan and I really appreciate your work!). I have the board and I can test the realease if you want... Mikeskylar from adafruit write: "It might be a matter of adding a board identifier and possibly some pin assignments. The NRF52 / NRF52840 board identifier is already in place in the library." So it seems no so difficult... Otherwise I can try by myself if you - please - give me some hints on how to proceed... Anyway thanks so much!

ladyada commented 2 years ago

you can look at other PR's for ideas on how to add it, or ask the maker of the board to help add support. it may not be hard but we do not own the board so we can't test.

ladyada commented 2 years ago

@per1234 fyi, maybe someone who has a nicla can contribute a PR? :)

sapienshawk commented 2 years ago

I really appreciate your help! (what is PR?) .. Anyway I'd like to contribute.. but do not have necessary know how. I can if you give me hints... otherwise may I contribute in some way with money? Thanks so much regards.

sapienshawk commented 2 years ago

Dear sirs, no hope to have support on this issue? Can you please redirect me to some paid service? Thanks regards

Alexandra182 commented 2 years ago

Hello! I had the same problem so I tried to fix it myself. I've made a PR that fixes this issue, you can find it here. Let me know if it works for you!

sapienshawk commented 2 years ago

Hello! I will check as soon as possible! Meanwhile thank so much!!!! Great! ing.Amedeo Lepore mail: @.*** phone: +39 348 7017 257

Il giorno mer 5 ott 2022 alle ore 04:52 Alexandra Covor < @.***> ha scritto:

Hello! I had the same issue so I tried to fix it myself. I've made a PR that fixes this issue, you can find it here https://github.com/adafruit/Adafruit_NeoPixel/pull/331. Let me know if it works for you!

— Reply to this email directly, view it on GitHub https://github.com/adafruit/Adafruit_NeoPixel/issues/319#issuecomment-1267844691, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKMHJ2BWR4PCTXQEWPHQEHDWBTUNRANCNFSM5R354H6A . You are receiving this because you authored the thread.Message ID: @.***>

Cali1205 commented 1 year ago

Hi @Alexandra182,

thanks for the fix. I tried it and I'm facing the issue that somehow the PIN is not set. So it compiles and upload --> no issue. But then there is no reaction and also the initial setting of the Output Pin to LOW is not done.

Anybody else tried it out and perhaps can provide some working code?

Here is mine:

#include <Arduino.h>
#include "Nicla_System.h"
#include "Arduino_BHY2.h"
#include <Adafruit_NeoPixel.h>

SensorOrientation orientation(SENSOR_ID_ORI);

#define LED_PIN GPIO3
#define LED_COUNT 10
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup(){
  Serial.begin(115200);
  BHY2.begin();
  orientation.begin();
  nicla::begin();
  nicla::leds.begin();
  strip.begin();
}

Thanks a lot!

Alexandra182 commented 1 year ago

Hi @Cali1205,

If you want to connect the NeoPixels to GPIO3 you can use this line of code:

#define PIN 0

according to the pinout.

#define LED_PIN GPIO3 didn't work for me either.

This is the code that worked for me:

#include <Adafruit_NeoPixel.h>

#define PIN       0 
#define NUMPIXELS 1 

Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

#define DELAYVAL 500

void setup() {
  pixels.begin();
}

void loop() {
  pixels.clear();

  for(int i=0; i<NUMPIXELS; i++) {
    pixels.setPixelColor(i, pixels.Color(random(250), random(250), random(250)));
    pixels.show();
    delay(DELAYVAL);
  }
}
Cali1205 commented 1 year ago

Thanks a lot @Alexandra182,

that works fine for me. It seems that the use of the Pindescription used for the mapping of GPIO3 --> Pin 10 is not working properly...

2022-12-05