The reference to 37 sensors and modules has been widely circulated on the Internet. In fact, there must be more than 37 sensor modules compatible with Arduino. In view of the fact that I have accumulated some sensor and actuator modules on hand, in accordance with the concept of true knowledge (must be hands-on), for the purpose of learning and communication, here I am going to try and do more experiments one by one. Whether it is successful or not, it will be recorded ——Small progress or unsolvable problems, I hope to be able to throw bricks and spark jade.
[Arduino] 168 kinds of sensor module series experiment (data code + simulation programming + graphic programming)
experiment 13: TTP223 touch button module self-locking jogging capacitive switch single-channel transformation SUNLEPHANT
Several experiments on TTP223B capacitive touch button module
1. Experimental environment
1. Hardware list required for the experiment——
Arduino Uno development board X1
DuPont lines (10 pieces are prepared)
LED light-emitting diode (blue) X1
220 ohm current-limiting resistor (1 /8W) x1
low-level trigger single-channel 5V relay module X1
TTP223B capacitive touch key module (four types) X4
Proto Shield prototype expansion board (with mini breadboard) X1
key switch module (pull-down resistor and pull-up resistor 1 each ) x2
2. The software platform required for the experiment -
code programming Arduino IDE (version 1.8.13),
simulation programming Linkboy (version V4.2),
graphics programming Mind+ (version V1.7.0 RC1.0) and learning while programming (online platform)
3. Experimental wiring diagram——
2. Experiment 1: Use jog mode to view serial port data and output waveform
1. Experiment 1 refers to open source code (Arduino):
/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验一:使用点动模式查看串口数据及输出波形
接线:
触摸模块 Uno
VCC Vcc
GND GND
SIG A0
*/
void setup()
{
pinMode(A0,INPUT); // 设置模拟口A0为输入端
Serial.begin(9600);
}
void loop()
{
Serial.println(analogRead(A0)); //打印串口数据
delay(100);
}
Experiment 1 Open the serial monitor and check the output
3. Experiment 1 Open the serial port plotter (open the toolbar first) to view the output waveform
4. Experiment 1 Experiment scene diagram
5. Experiment 2 Open Source Graphics Programming (Mind+, Learning by Playing)
3. Experiment 2: Use the self-locking mode to view the serial port data and output waveform
1. Weld the "B" point to become a self-locking bistable mode
2. Experiment 3 refers to open source code (Arduino):
/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验三:使用自锁模式查看串口数据及输出波形
接线:
触摸模块 Uno
VCC Vcc
GND GND
SIG A0
*/
void setup()
{
pinMode(A0, INPUT); // 设置模拟口A0为输入端
Serial.begin(9600);
}
void loop()
{
Serial.println(analogRead(A0)); //打印串口数据
delay(100);
}
3. Experiment 2 Open the serial monitor and check the output data
4. Experiment 3 Open the serial port plotter and view the output waveform
4. Experiment 4: Use the jog mode, touch and press the LED light to turn on, release it to turn off
1. Experiment 4 refers to the open source code (Arduino):
/*
【Arduino】168种传感器模块系列实验(资料代码+仿真编程+图形编程)
实验四:使用点动模式,触摸按下LED灯亮,松开熄灭
接线:D13板载LED灯
触摸模块 Uno
VCC Vcc
GND GND
SIG D2
*/
void setup(){
pinMode(2, INPUT); //设置D2为输入
pinMode(13, OUTPUT); //设置D13为输出
}
void loop() {
if (digitalRead(2)) {
//如果D2有信号
delay(100);
digitalWrite(13, HIGH); 则点亮LED
}
else {
digitalWrite(13, LOW); 否则熄灭LED
}
}
2. Experiment 5 Open source simulation programming (Linkboy V4.2)
3. Experiment 6: Open source graphics programming (Mind+, learning while editing)
4. Experimental scene diagram