Need help with slowing down fastLED library patterns via hobby RC controller please..
I have been having a heck of a time learning to program a simple double "Cylon" traveling dots pattern to slow down/speed up using the pw timing of a hobby RC receiver signal on pin2.
here's video to get an idea of what I'm trying to do
the code that is ran on the Uno Rev. 2 board is this..
the library for fastLED is here
problem is that pulseIn eats up ~20uS's each time it is called.
so to have it run each time I draw a pair of dots slows it WAYYY down.
So in the code I had to run it every 7th LED it draws to help update the speed value, yet not update it via pulseIn too often.
I update it the 1st LED pair, the 7th, 14th, 22nd and 30th, then backwards until going forwards again..
so eight times for each full cycle of the pattern.
While this seems OK for use as it is, I'd rather have more variation of the speed and I know there must be a way to use interrupts to get the PW value vs. this slow way using pulseIn.
Well I tried using interrupts.
1st I tried to use PinChangeInt but I had issues with the library or something.. I had major errors I couldnt figure out. >:(
So I move on to trying attachInterrupt instead and used INT0/Pin 2 to read the PWM signals.
Here's the code
while I can get a good reading of the PW value's LOW signal using the serial monitor, I cannot seem to use the value 'pulse_time' to alter the delay value at the end of each pair of dots drawn without it locking up on me.
I tried to comment the code best I could to describe what it is doing.
can anyone please help show me what I need to do to use the attachInterrupt method properly here?
I really dont want to mess with PinChangeInt right now. I am happy with using INT0 and INT1 for two channels off my RC Receiver. One for throttle and the other for attitude(turn left/right).
I've been messing with it for two days now and simply not getting anywhere with it.. very frustrating.
I also posted this at the fastLED google+ community, but thought I'd try to get help here too.
Thanks in advance,
~Blaine