参考
いろいろ注意
- 過去ログを見ょ!!!
- 変更点
const int buttonPin = 1;
結果 ERROR
プログラム
#include "USB.h"
#include "USBHIDKeyboard.h"
USBHIDKeyboard Keyboard;
const int buttonPin = 1;
int previousButtonState = HIGH;
int counter = 0;
void setup() {
pinMode(buttonPin, INPUT_PULLUP);
Keyboard.begin();
USB.begin();
}
void loop() {
int buttonState = digitalRead(buttonPin);
if ((buttonState != previousButtonState) && (buttonState == LOW)) {
counter++;
Keyboard.print("You pressed the button ");
Keyboard.print(counter);
Keyboard.println(" times.");
}
previousButtonState = buttonState;
delay(1);
}
