I have a pro mini which drives 2 RGB LED strips on its 6 PWM pins, via 6 2N7000 N-channel MOSFETs. Alongside these, I have 4 x MAX7219 modules in series controlled via SPI. Both work perfectly, but not concurrently - yet. I need to do sleek PWM on the RGB strips whilst outputting scrolling text on the MAX7219s. The functions for the MAX7219 display take some time to complete for each blob of text.
I added a udelay() function (works like delay(), but just uses delayMicroseconds instead) so I could use interrupts/timers.
I am now interested in the best practice for doing that - I have no experience with interrupts, and would rather not use something lile FreeRTOS for this.
Desired functionality: 1) Drive 2 RGB LED strips on 6 PWM pins, smoothly. 2) While at the same time outputting arbitrary text/foo on the MAX7219s on SPI.
I have this snippet for smoother RGB fading ( http://forum.arduino.cc/index.php?topic=12004.0 ) and would also like to know what variables
displace denote, and if this method has merit.
time = millis();
value = 128+127*cos(2*PI/periode*time);
value2 = 128+127*cos(2*PI/periode*(displace-time));
analogWrite(ledpin, value); // sets the value (range from 0 to 255)
analogWrite(ledpin2, value2); // sets the value (range from 0 to 255)
@Majenko et al?
Cluebats at the ready - any advice would be appreciated!
The functions for the MAX7219 display take some time to complete for each blob of text.- They shouldn't. How are you driving them? Have you thought about interleaving updating each row with updating your LED strips? What are you even considering any form of delay function?