Quantcast
Viewing all articles
Browse latest Browse all 45758

Elegant Strobe Lights & Performence Impact

@Miro_Ohana wrote:

So, I would like to add strobe lights controlled by the APM.
I would like to control a led, using PWM to create smooth strobe light.

It is my first go with AP code, and the easiest way was to connect the led to RC5,
and use hal.rcout->write();
However, it MADE EVERYTHONG SLOW and LAGGY. The copter took 20 seconds to arm, wouldn't dare flying it !
Any Ideas what causes this performence impact? I'm not sure what is taking so many resources.
is there a more "cheap" way of achieving this?

Code looks like this:

`#ifdef USERHOOK_FASTLOOP
void USERHOOK_FASTLOOP()
{
if(pwm==max_pwm || pwm==min_pwm)
{
inc = -inc;
}
if(pwm==min_pwm)
{
hal.scheduler->delay(1500);
}

pwm += inc;
uint8_t _channel=5;
hal.rcout->enable_ch(_channel-1);
hal.rcout->write(_channel-1, pwm);

hal.scheduler->delay(15);

}

endif`

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 45758

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>