當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Arduino Scheduler - Scheduler.startLoop()用法及代碼示例

向調度程序添加一個函數,該函數將與 loop() 並發運行。

用法

Scheduler.startLoop(loopName);

參數

  • loopName :要運行的命名函數。

返回

None。

示例

#include <Scheduler.h>

int counter = 0;
int counter1 = 0;

void setup() {
  Scheduler.startLoop(loop1);
}

void loop () {
 analogWrite(9, counter);
 counter++;

 if (counter > 255){
  counter = 0;
 }

 delay(33);
}

void loop1 () {
 analogWrite(10, counter1);
 counter1 = counter1 + 5;

 if (counter1 > 255) {
  counter1 = 0;
 }

 delay(10);
 yield();
}

相關用法


注:本文由純淨天空篩選整理自arduino.cc大神的英文原創作品 Scheduler - Scheduler.startLoop()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。