Arduino interrupt tact switch 예제
2016-10-13 18:18:23 # Arduino

아두이노 택스 스위치 인터럽트 예제입니다.

아두이노

아두이노

아두이노

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
volatile int buttonState = LOW;
void setup()
{
Serial.begin(9600);
attachInterrupt(0, showTemperatures, CHANGE);
}

void loop()
{
for (int i = 0; i < 1000; i++)
{
delay(100);
}
}

void showTemperatures()
{
buttonState = !buttonState;
Serial.print("Button : ");
Serial.println(buttonState);
}