#define SWITCH_PIN 13
void setup() {
// ピンモード設定
pinMode(SWITCH_PIN, INPUT_PULLUP);
// シリアルモニタ初期化
Serial.begin(9600);
}
void loop() {
// 1秒ごとにスイッチ状態をシリアルモニタに表示
Serial.println( digitalRead(SWITCH_PIN) );
delay(1000);
}
#define SWITCH_PIN 13
void setup() {
// ピンモード設定
pinMode(SWITCH_PIN, INPUT_PULLUP);
// シリアルモニタ初期化
Serial.begin(9600);
}
void loop() {
// 1秒ごとにスイッチ状態をシリアルモニタに表示
Serial.println( digitalRead(SWITCH_PIN) );
delay(1000);
}