Pandabyte Switch Module: Digital Input Guide
by pandabyte in Circuits > Arduino
30 Views, 0 Favorites, 0 Comments
Pandabyte Switch Module: Digital Input Guide
Pandabyte Switch Module is a simple sensor module used for learning digital input control with microcontrollers such as Arduino compatible boards, ESP32, or Raspberry Pi Pico.
A key feature of this module is that it supports two connection methods:
- Traditional male header pins for standard jumper-wire connections
- 4-pin Grove connector for quick plug-and-play prototyping without complex wiring
In this guide, you will learn:
- Module pin configuration
- Digital input control
- Circuit connections and Arduino programming example
Supplies
Hardware:
- PandaByte Switch Module
- Development Board (We will use PandaByte xC3m ESP32C3 Dev board)
- Grove Shield/Expansion Board
- Cables: Dupont, USB, and Grove
Software:
- Arduino IDE
Circuit Connections
Perform the connection based on the table.
Programming
Example 1: Read the switch state using a digital signal and print the status on the serial monitor.
int switchPin = 0;
void setup() {
pinMode(switchPin, INPUT);
Serial.begin(115200);
}
void loop() {
int switchState = digitalRead(switchPin);
if(switchState == HIGH) {
Serial.println("Switch Pressed");
}
else {
Serial.println("Switch Released");
}
delay(200);
}
Output
The Serial Monitor will display:
- “Switch Pressed” when the button is pressed
- “Switch Released” when the button is not pressed
Important Info
- The switch module is a digital input device.
- You can connect the IN pin to any GPIO pin that supports digital input.