Specification
| Unit | Min | Typical | Max | |
| Supply Voltage | VDC | 2 | 3 | 5.5 |
| Working Current (VCC = 5V) | uA | - | 18 | - |
| Digital Output Voltage (VCC = 5V) | V | 0 | - | 5 |
Demo:
Connect S port of electronic brick of touch button switch to D2 port of Arduino board, and we will use the following program to read its digital value. When the digital value read is low level, LED lamp will be ON; when the digital value read is high level, LED lamp will be OFF.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
int Button=2; //connect button to D2
int LED=13;
void setup()
{
pinMode(LED, OUTPUT);
pinMode(Button, INPUT);
}
void loop()
{
if(digitalRead(Button)==HIGH) //when the digital output value of button is high, turn on the LED.
{
digitalWrite(LED, LOW);
}
if(digitalRead(Button)==LOW) //when the digital output value of button is low, turn off the LED.
{
digitalWrite(LED, HIGH);
}
}