本文整理汇总了C++中LED::off方法的典型用法代码示例。如果您正苦于以下问题:C++ LED::off方法的具体用法?C++ LED::off怎么用?C++ LED::off使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LED
的用法示例。
在下文中一共展示了LED::off方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: launchChildProcess
int launchChildProcess(int processIndex, ChildProcess *childProcesses, int totalChildProcesses, LED &ledIndicator) {
int status, waitTimeout = 0;
pid_t childID, endID;
time_t when;
if ((childID = fork()) == -1) { // Start child process.
perror("fork error");
exit(EXIT_FAILURE);
}
else if (childID == 0) { // The child process.
exit(childProcesses[processIndex].func());
}
else // The parent process.
{
char *descr = childProcesses[processIndex].description;
time(&when);
printf("Parent process started at %s", ctime(&when));
for(;;) { // Wait for child process to terminate.
endID = waitpid(childID, &status, WNOHANG|WUNTRACED);
if (endID == -1) // Error calling waitpid.
{
perror("waitpid error");
exit(EXIT_FAILURE);
}
else if (endID == 0) // Child still running.
{
time(&when);
printf("Waiting for %s at %s", descr, ctime(&when));
waitTimeout++ % 2 == 0 ? ledIndicator.on() : ledIndicator.off();
sleep(1);
}
else if (endID == childID) // Child ended.
{
if (WIFEXITED(status))
printf("%s ended normally. status: %d at %s\n", descr, status, ctime(&when));
else if (WIFSIGNALED(status))
printf("%s ended because of an uncaught signal at %s.\n", descr, ctime(&when));
else if (WIFSTOPPED(status))
printf("%s process has stopped at %s.\n", descr, ctime(&when));
return status;
}
}
}
return 1;
}
示例2: StopDrillMove
// Stop drill movement, sets lifting and lowering pins to LOW state.
void StopDrillMove(){
DrillUp.off();
DrillDown.off();
}
示例3: off
void off() {
lcd.noDisplay();
led.off();
}
示例4: loop
void loop()
{
if(bNewThrottleSignal0&&bNewThrottleSignal1&&
1)
{
int A= nThrottleIn0;
Serial.print("0:");
Serial.print(A);
Serial.print(" 1:");
int B= nThrottleIn1;
Serial.println(B);
if(A<1910){
//forward
if(A<1400 && B>1400 && B<1600){
P5.writeForward(A);
P6.writeForward(A);
P7.writeForward(A);
P8.writeForward(A);
// L5.on();
// L8.on();
// L7.on();
// L6.on();
L9.off();
L10.off();
}
//Left
else if(B<1400){
P6.writeForward(1300);
P8.writeForward(1300);
P5.writeBackward(1700);
P7.writeBackward(1700);
L9.on();
L10.off();
}
else if(B>1600){
P5.writeForward(1300);
P7.writeForward(1300);
P6.writeBackward(1700);
P8.writeBackward(1700);
L10.on();
L9.off();
}
//turn left
// else if(B<1400 && A<1400){
// int sa = ((A-1400)*(-1))+1600;
// P6.writeForward(A);
// P8.writeForward(A);
// P5.writeBackward(sa);
// P7.writeBackward(sa);
// // L5.off();
// // L6.on();
// // L7.off();
// // L8.on();
// L9.on();
// L10.off();
// }
// //turn right
// else if(B>1600 && A<1400){
// int sa = ((A-1400)*(-1))+1600;
// P5.writeForward(A);
// P7.writeForward(A);
// P6.writeBackward(sa);
// P8.writeBackward(sa);
// // L5.on();
// // L6.off();
// // L7.on();
// // L8.off();
// L9.off();
// L10.on();
// }
//backward
else if(A>1600 && B>1400 && B<1600){
P5.writeBackward(A);
P6.writeBackward(A);
P7.writeBackward(A);
P8.writeBackward(A);
// L5.on();
// L6.on();
// L7.on();
// L8.on();
L9.on();
L10.on();
}
//leftback
// else if(B<1400 && A>1600){
//.........这里部分代码省略.........
示例5: main
int main()
{
signal(SIGINT, sig_handler);
LCD lcd;
LED led;
Knob knob;
Button button;
int knob_value = 0;
bool button_value = false;
char msg[18];
std::string ip;
led.on();
while( (ip = get_ip("wlan0")).length() == 0 )
{
lcd.clear();
lcd.write("looking for IP ");
sleep(1);
}
led.off();
lcd.clear();
lcd.setCursor(0, 0);
lcd.write("My IP Address:");
lcd.setCursor(1, 0);
lcd.write(ip.c_str());
sleep(3);
lcd.clear();
lcd.setCursor(0, 0);
lcd.write(ip.c_str());
while( running == 0 )
{
lcd.setCursor(1, 0);
snprintf(msg, sizeof(msg), "knob: %d%% ", knob.percent());
lcd.write(msg);
if( button.value() )
{
led.on();
}
else
{
led.off();
}
if( (button_value != button.value()) || (knob.percent() != knob_value) )
{
button_value = button.value();
knob_value = knob.percent();
// post( button_value, knob_value );
}
usleep(100000);
}
return MRAA_SUCCESS;
}