So I just got an APM for my quad at it’s amazing. One thing I want to try and do is control addressable RGB LED strips. The idea is that the LED strips could change colors and patterns depending on the APM’s current flight mode, battery voltage, altitude, etc.
I will be controlling the strips using a teensy 3.1 which is already working great. Now I’m looking to communicate with the teensy over I2C on the APM. I’m fairly new to the APM’s code and It looks like things won’t be as simple as just using the Arduino Wire.h library. I’ve looked through the APM source code and found the code for the I2C Driver which may be what I’m looking for, but so far I have been unable to figure it out.
I was hoping someone here might be able to help me out or point me in the right direction. I need the APM acting as a I2C master to communicate and send small packets containing things like current mode and possibly a few integers to the teensy acting as a slave device. Is this something I can implement in the user hooks and how so? Thank you for your time really hoping someone else out there has figured this out before.
Just listen to mavlink, much easier.
Have you looked at the code already being used to control the ToshibaLED? I’d start there. In fact, you might not need to do much at all, just pretend to be that ToshibaLED. Or, if you want to change the actual functionality, just clone the ToshibaLED library, and then go from there. You’ll see this code in AP_Notify (not the most obvious name).
Thank Andre that might be what I end up having to do. I was hoping that I could use I2C communication as easily as with the Arduino Wire.h library but it looks like that might not be the case. The reason I wanted to use I2C is because parsing the mavlink packets looks like it will be a lot of work and could cause issues with the neopixel’s timing requirements and the animations I’m trying to run.
In response to Rob, thanks for the tip I’ll take a look at the I2C communication between the Toshiba LED and APM. All I need is to send a few bytes from the APM to the Teensy. The Teensy will handle all the logic and protocol for controlling the neopixel strips.
Thanks guys, I’ll be sure to post any solution I find and the final product if I ever get this figured out.