I'm trying to run the 'simple' example from the Adafruit_neopixel library. How do I declare the Neopixel pin number when using say pin 0 on the MCP23008 - or is this impossible?
I don't think that will be an option. The NeoPixel parts need very tight control of the timing in order to work, if the pin timing is wrong by 100 us the wrong data will get latched in.
Can you move some other functions / pins onto the IO expander and then drive the neopixels directly from the processor?
I think you will need to write your own library. This isn't as bad as it seems. If the library uses analog write then it won't work, because I don't think you can do PWM with that expander.
The library writes directly to pins. You need to intercept this behaviour and tell the library to tell the MCP230008 to write to the pin. I haven't seen the library I question, but this should be straight forward.
If you take the existing Adafruit library and find where it writes to a pin. Rather than calling
digitalWrite it needs to call
expanderWrite(pin, state). Every instance of
pinMode() needs replacing with
explanderPinMode(pin, mode) Then write yourself those two functions that use I2C/SPI to set the IOX's registers to implement what you need.
The IO Expander is not going to be a good idea if the library requires critical accurate timing, because of the lag of telling the IOX to do things. An alternative is to use another D1 as the IO expander.