0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

osを作る その17

Posted at

概要

osを作る。
wemosで、tickerを使ってみた。

サンプルコード

# include <Ticker.h>

Ticker tk1;
Ticker tk2;
Ticker tk3;

void task1(void) {
	Serial.print("task1  ");
	Serial.println(millis());
}

void task2(void) {
	Serial.print("task2  ");
	Serial.println(millis());
}

void task3(void) {
	Serial.print("task3  ");
	Serial.println(millis());
}

void setup() {
	Serial.begin(9600);
	tk1.attach_ms(100, task1);
	tk2.attach_ms(200, task2);
	tk3.attach_ms(300, task3);
}

void loop() {
}





結果


task1  245
task2  245
task1  345
task3  345
task1  445
task2  445
task1  545
task1  645
task2  645
task3  645
task1  745
task1  845
task2  845
task1  945
task3  945
task1  1045
task2  1045
task1  1145
task1  1245
task2  1245
task3  1245
task1  1345
task1  1445
task2  1445
task1  1545
task3  1545
task1  1645
task2  1645
task1  1745
task1  1845
task2  1845
task3  1845
task1  1945
task1  2045
task2  2045
task1  2145
task3  2145
task1  2245
task2  2245
task1  2345
task1  2445
task2  2445
task3  2445
task1  2545
task1  2645
task2  2645
task1  2745
task3  2745
task1  2845
task2  2845
task1  2945
task1  3045
task2  3045
task3  3045
task1  3145
task1  3245
task2  3245
task1  3345
task3  3345
task1  3445
task2  3445
task1  3545
task1  3645
task2  3645
task3  3645
task1  3745
task1  3845
task2  3845
task1  3945
task3  3945
task1  4045
task2  4045
task1  4145
task1  4245
task2  4245
task3  4245
task1  4345
task1  4445
task2  4445
task1  4545
task3  4545
task1  4645
task2  4645
task1  4745
task1  4845
task2  4845
task3  4845
task1  4945
task1  5045
task2  5045
task1  5145
task3  5145
task1  5245
task2  5245
task1  5345
task1  5445
task2  5445
task3  5445
task1  5545
task1  5645
task2  5645
task1  5745
task3  5745
task1  5845
task2  5845
task1  5945
task1  6045
task2  6045
task3  6045
task1  6145
task1  6245
task2  6245
task1  6345
task3  6345
task1  6445
task2  6445
task1  6545
task1  6645
task2  6645
task3  6645
task1  6745
task1  6845
task2  6845
task1  6945
task3  6945
task1  7045
task2  7045
task1  7145
task1  7245
task2  7245
task3  7245
task1  7345
task1  7445
task2  7445
task1  7545
task3  7545
task1  7645
task2  7645
task1  7745
task1  7845
task2  7845
task3  7845
task1  7945
task1  8045
task2  8045
task1  8145
task3  8145
task1  8245
task2  8245
task1  8345
task1  8445
task2  8445
task3  8445
task1  8545
task1  8645
task2  8645
task1  8745
task3  8745
task1  8845
task2  8845
task1  8945
task1  9045
task2  9045
task3  9045
task1  9145


以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?