Help with the Pololu Library

Hello :slight_smile:

First of all, I’m an absolute beginner. Sorry for that. I bought the polulu neopixel ring with 60 LEDs. Now, I want it to interact with a scale (HX711), in a way that the percentage of the ring lits up when weight is added (e.g. when the finally desired weight is 200 grams, half the ring is lit when 100 grams are on the scale. Ideally, it also changes colour whilst doing so ( from pink/red over orange/yellow to green). I’m working on the code since quite some time (my first time with C++), but I’m struggling with the led ring. I am confused with the libraries for adafruit and polulu. I think I managed some of the code for the adafruit library, but I just don’t get it working at all on the polulu. Can you help me with that transfer? That would be great!

My code is the following:

Ring_attempt.ino (8.0 KB)

Hello.

Just to be clear, the NeoPixel is made by Adafruit, not Pololu.

It sounds like you are trying to use the Adafruit NeoPixel library and our Arduino PololuLedStrip library together in your code. If that is the case, you should only need to use one, not both. Our library is an alternative option to the Adafruit NeoPixel library. Is there a good reason why you want to use both?

By the way, since there seems to be a lot of different features you want to implement in your project, I strongly recommend focusing on getting one behavior down (e.g. showing the weight correctly on the NeoPixel ring regardless of what color) before adding more features.

- Amanda

Dear Amanda,

I am sorry, I just read through my entry and realised how confusing and unprofessional it was. I’ve been working for hours and couldn’t concentrate properly. Feel free to delete my form entry, it is a bit embarassing to be honest. Sorry again.

Your advice sounds very reasonable and I tried to follow it. Nevertheless, I still struggle to “translate” parts of the adafruit library into the pololu library. Maybe you can help me with the following questions:

  1. How do I control the brightness of the LEDs?

  2. How do I simply light up the whole ring in one colour?

  3. How do I establish a gradient change of colour of all neopixels?

Thank you very much and sorry again. I have not been myself, I guess.

All the best & stay healthy,

Emma

Your post is fine. I wanted to make it absolutely clear that NeoPixels are not made by Pololu just in case you thought that (although we do sell them) and to avoid confusing others who might be following this thread.

I’m still not understanding what you are trying to “translate” or “transfer” between the Adafruit NeoPixel library and the PololuLedStrip library. As I said in my previous post, you only need to use one of the two libraries, and either of them should work fine for controlling the LEDs. I think the first step is for you to pick which library you want to use: the Adafruit NeoPixel library or the Arduino library for addressable RGB LED strips from Pololu (or PololuLedStrip).

You might consider using the PololuLedStrip library, since it contains some useful examples like testing color and creating a gradient effect. I strongly recommend running some of the library examples, read the comments in the code, and make some minor modifications to the code to better your understanding of how the functions and the program as a whole works before continuing on with your project. Doing so would probably help you answer your own questions.

If you run into problems and still have questions, please let me know.

- Amanda

Thank you very much for your answer. I wanted to “translate” the code that I wrote with the adafruit neopixel library in a way that I can use it with the pololu library. I wanted to do this, because I failed to introduce (is that the correct word?) the LED ring in the code. The didn’t work for me: Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, 7, NEO_RGB + NEO_KHZ800);, probably because I got the last argument wrong. I would be very grateful for any advise here. Thank you very much.

It sounds like you are just having trouble getting the Adafruit NeoPixel library to work. If you want to focus on getting the Adafruit library to work instead of trying to port over your code such that it uses the PololuLedStrip library, I suggest contacting Adafruit for further assistance. Otherwise, if you want to use the Pololu library, please run some of the examples in the library as-is to confirm that your LEDs are working, then try modifying them to get the behavior you want for your project. Please read the code comments carefully to understand how each example works and how the LEDs respond to the code.

- Amanda