Pandabyte Switch Module: Digital Input Guide

by pandabyte in Circuits > Arduino

30 Views, 0 Favorites, 0 Comments

Pandabyte Switch Module: Digital Input Guide

switch.png

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:

  1. Traditional male header pins for standard jumper-wire connections
  2. 4-pin Grove connector for quick plug-and-play prototyping without complex wiring

In this guide, you will learn:

  1. Module pin configuration
  2. Digital input control
  3. Circuit connections and Arduino programming example

Supplies

items - Copy.png

Hardware:

  1. PandaByte Switch Module
  2. Development Board (We will use PandaByte xC3m ESP32C3 Dev board)
  3. Grove Shield/Expansion Board
  4. Cables: Dupont, USB, and Grove

Software:

  1. Arduino IDE

Circuit Connections

switch connection.png

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:

  1. “Switch Pressed” when the button is pressed
  2. “Switch Released” when the button is not pressed

Important Info

  1. The switch module is a digital input device.
  2. You can connect the IN pin to any GPIO pin that supports digital input.