Last active
August 16, 2018 04:15
-
-
Save likersacademia/518e31c53b1a0690327e50c0dfe5e180 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* スイッチのON-OFFをシリアルモニターに表示するプログラム | |
#define buttonPin 12 | |
int buttonState = 0; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(buttonPin, INPUT); | |
} | |
void loop() { | |
buttonState = digitalRead(buttonPin); | |
if (buttonState == HIGH) { | |
Serial.println("Switch ON"); //Switch ONのところを好きな文章にできます | |
delay(1000); //判定間隔(1000=1秒)が変わります。 | |
} else { | |
Serial.println("Switch OFF"); ////Switch OFFのところを好きな文章にできます | |
delay(1000); //判定間隔(1000=1秒)が変わります。 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment