Quantcast
Channel: ArduCopter - ArduPilot Discourse
Viewing all articles
Browse latest Browse all 21355

Elegant Strobe Lights & Performence Impact

$
0
0

@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(unused on quad),
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: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 21355

Trending Articles