32u4bb: keyled.2.ino

File keyled.2.ino, 772 bytes (added by iori, 7 years ago)

出荷時に書き込まれているピンチェックつきHello, Arduino のスケッチ

Line 
1#define LED_PIN 13
2
3const int cldcount = 38;
4void setup() {
5int ledcount;
6int bluec    = 10;
7int i = 100;
8  DDRF = 0xF3;
9  PORTF = 0xF3;
10  digitalWrite(A0, HIGH);
11  Keyboard.print("Hello Arduino");
12  ledcount = cldcount;
13  while (ledcount)
14    pinMode(--ledcount, OUTPUT);
15  while (bluec--){
16    ledcount = cldcount;
17    while (ledcount)
18      digitalWrite(--ledcount, HIGH);
19    delay(7);
20    ledcount = cldcount;
21    while (ledcount)
22      digitalWrite(--ledcount, LOW);
23    delay(3);
24  }
25}
26
27void loop() {
28static int kc = 0;
29static int ledcount = 0;
30static int togflag = 0;
31  if (ledcount == cldcount){
32          togflag ^= 1;
33          ledcount = 0;
34  }
35  if (kc++>50){
36          kc = 1;
37          Keyboard.print("Hello Arduino");
38  }
39  digitalWrite(ledcount++, togflag?LOW:HIGH);
40  delay(10);
41}
42