I’m having trouble understanding the Serial timing, SPI vs WS2812 issue for combining with sound and other things like IMUs . I think I kinda get the idea (which makes me think I really don’t) but how do I know if it’s going to be a problem?
So assuming my libraries aren’t engaging in background regular communication via Serial with the IMU, I’m fine doing:
sensors_event_t accel, mag, gyro, temp;
lsm.getEvent(&accel, &mag, &gyro, &temp);
float ay = accel.acceleration.y;
float ax = accel.acceleration.x;
float az = accel.acceleration.z;
//do some stuff
FastLED.show();
Using the Adafruit sensor Library?
It’s a bit more complicated than that - what hardware are you running on? This is less of an issue with, say, the teensy3.x than with Avr based arduinos. I don’t know whether or not the library is using interrupts (or using something, like i2c that requires interrupts) or timers. (And I’m not in a spot where I can go diving through their library code to find out - but perhaps someone here knows?)
Currently on an UNO but just about to make the switch to Teensy because I’m running out of SRAM and program space. I’m trying to do lights, motion, sound, and possibly adjust the settings via bluetooth, as well as a 315mz reciever for remote buttons.
Their library uses i2c by default and can use software or hardware SPI
I2C requires heavy use of interrupts on avr as I recall. Even with serial and hardware spi, depending on the rate that data is coming in, any data that comes in while writing out led data is likely to get lost on avr. At least on the teensy 3.x we can periodically re-enable interrupts while writing led data out to handle things like that (unless their interrupt handlers take too long and cut off the writing of led data)
Ok, it sounds like I’m clearly going to have to go learn more about Serial communication and delve into the libraries if I want to be able to account for when they’re actually talking to each other.
I know I can just use SPI leds to avoid all this but I want to understand then avoid problems rather than just avoid them. Thanks for the help!