--------------------------------
int sw=2;
int count=0;
void setup() {
// put your setup code here, to run once:
pinMode(sw,INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(sw) == 1) {
count = count + 1;
Serial.print("Count : ");
Serial.println(count);
while (digitalRead(sw)== 1) {
delay(100);
}
}
}
-----------------------------------
0 件のコメント:
コメントを投稿