本文整理汇总了C++中LED::toggle方法的典型用法代码示例。如果您正苦于以下问题:C++ LED::toggle方法的具体用法?C++ LED::toggle怎么用?C++ LED::toggle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LED
的用法示例。
在下文中一共展示了LED::toggle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testloop
void testloop()
{
//select which loop routine you want to execute
//#define TEST_GROUNDLINK
//#define TEST_UAVTALK
//#define TEST_MAVLINK
//#define TEST_ARDUIMU_V3
//#define TEST_NODELINK
//#define TEST_BLINK_APBOARD
//#define TEST_SERVOS
//#define TEST_QUADCOPTER
//#define TEST_SPEKTRUMSATELLITE
//#define TEST_IMU_CHR6D
#ifdef TEST_QUADCOPTER
/* Basic quadrocopter nick and roll damping. Sequence of events:
* 1.) Reads gyros to get d(nick)/dt and d(roll)/dt in °/s
* 2.) Gets RC receiver input ([-1000, +1000]) to determine
* a) the desired vertical acceleration [m/s²]
* b) the desired pitch and roll rate [°/s]
* 3.) calculates
* a) the necessary level of thrust for all 4 engines to achieve the desired vertical acceleration (open loop, for now)
* b) the necessary level of thrust offsets for the left/right and leading/rear engine. E.g. for a desired nick
* rate of 10°/s that may be +120/-120
* 4.) Sets the calculated gas positions.
*/
int32_t v = 0;
while(true){
TimeBase::waitMicrosec(100000);
//led->toggle();
// gLink->sendValue(v);
v--;
}
#endif
#ifdef TEST_ARDUIMU_V3
ArduIMU_V3* imu = new ArduIMU_V3();
Devices::backPointer->statusLED.set(LED::state_OFF);
while(true){
imu->test();
TimeBase::waitMicrosec(500000);
Devices::backPointer->statusLED.toggle();
}
#endif
#ifdef TEST_MAVLINK
LED* lede = new LED(GPIOC, GPIO_Pin_12, LED::state_ON);
MAVLink* mavlink = new MAVLink(USART2);
ArduIMU_V3* imu = new ArduIMU_V3();
lede->set(LED::state_OFF);
uint32_t heartBeatTime = TimeBase::getSystemTimeMs();
uint32_t airdataTime = TimeBase::getSystemTimeMs();
uint32_t newTime = 0;
while(true){
newTime = TimeBase::getSystemTimeMs();
// Do every second:
if((newTime - heartBeatTime)>1000)
{
mavlink->sendHeartbeat();
// lede->toggle();
heartBeatTime = newTime;
}
//Do every 10 milliseconds
if((newTime-airdataTime)>100)
{
mavlink->sendAirData((uint8_t)(imu->values.temp));
airdataTime = newTime;
}
}
#endif
#ifdef TEST_UAVTALK
LED* lede = new LED(GPIOC, GPIO_Pin_12, LED::state_ON);
UAVTalk* talk = new UAVTalk(USART2);
int32_t v = 0;
lede->set(LED::state_OFF);
while(true){
TimeBase::waitMicrosec(500000);
lede->set(LED::state_ON);
TimeBase::waitMicrosec(1000);
lede->set(LED::state_OFF);
talk->sendTestMessage();
v--;
}
#endif
#ifdef TEST_GROUNDLINK
LED* led = new LED(GPIOC, GPIO_Pin_12, LED::state_ON);
GroundLink* gLink = new GroundLink(USART2);
int32_t v = 0;
led->set_GPIOC_10(0);
while(true){
TimeBase::waitMicrosec(500000);
led->toggle();
TimeBase::waitMicrosec(500000)
gLink->sendRawInertial();
v--;
}
//.........这里部分代码省略.........