-->
Page 1 of 2

bitset() values?

PostPosted: Tue Apr 18, 2017 10:39 pm
by Chris Carter
Hi All,

I want to be able to drive LOTS of ws8212b "neopixels" using something like the guide here:

https://wp.josh.com/2014/05/13/ws2812-n ... know-them/

Would anyone know how I could work out the port addresses for an ESP8266 module? Preferably a NodeMCU or Wemos D1 mini, but any is fine really.

Re: bitset() values?

PostPosted: Tue Apr 18, 2017 11:24 pm
by Pablo2048
You can use ordinary Arduino functions digitalPinToPort() and digitalPinToBitMask(), but ESP8266 has only one GPIO port - so I suggest to use direct SET/RESET registers ( viewtopic.php?f=13&t=9407 )

Re: bitset() values?

PostPosted: Tue Apr 18, 2017 11:43 pm
by Chris Carter
Hmm I'm afraid my understanding of writing direct to registers is not very good. My understanding is that I have to define the following lines of code:

#define PIXEL_PORT PORTB // Port of the pin the pixels are connected to
#define PIXEL_DDR DDRB // Port of the pin the pixels are connected to
#define PIXEL_BIT 4 // Bit of the pin the pixels are connected to

What values should I put here so that the code would work? (Or how do I use SET/RESET of registers instead?)

Re: bitset() values?

PostPosted: Wed Apr 19, 2017 2:55 am
by Pablo2048
IMHO You can not simple change these values and expect to get working example. You have to dig deeper into given code and replace AVR specific stuff with the ESP one. Or (if You are unable to do this) use FastLED/Adafruit NeoPixel libraries...