problem with a variable
stilgar
Posts: 47
Hello I am having trouble. I am working on a program block (please note, this is only a small bit in a larger program) that uses the led_pwm.spin.
What I am trying to do is get the variable "maxbright" to start at 0 and increment to 64 and stop. after this block is completed "maxbright" will remain at 64 for all the rest of code that follows.
everything I have tried don't work at all or don't compile.
thanks
What I am trying to do is get the variable "maxbright" to start at 0 and increment to 64 and stop. after this block is completed "maxbright" will remain at 64 for all the rest of code that follows.
everything I have tried don't work at all or don't compile.
thanks
Comments
If you use a variable (I used "result") you can change its value from zero to maxbright like this.
This will only change the values of leds[7] and leds[8] though.
This will delay after each element of the two "leds" elements are set. If you want to delay after both elements are set you'd want to change the indentation on the waitcnt to this.
If you explain in more detail what you want to do, I (or others) may be able to help more.
Yes that whats I am trying to do. Many thanks to Duane Degn for the code it works great.
Now a new problem I need to fix is when the LEDs fad on, they seem to flicker. I think its a timing issue, but not sure.
I have attached all the program code I have done so far. The methood called "Death" , is not finished yet. this block is to slow the sweep speed to stop then fade the LEDs off.
In led_pwm_1.spin to:
You should get less flicker.
You might want to try several different values for "delay" to see what looks best.