pdf-icon

Arduino Quick Start

2. Devices & Examples

SwitchC6 Arduino Usage Guide

1.Preparation

2.Example Programs

Build Requirements
M5Stack Board Manager version >= 3.2.2
M5Unified library version >= 0.2.7
M5GFX library version >= 0.2.9
M5SwitchC6-ESP-NOW library version >= 0.0.1

Broadcast Scanning

Open the Broadcast_Scan example program included in the M5SwitchC6-ESP-NOW library, compile, and upload.

Press and hold the SwitchC6 button for 5 seconds, and it will broadcast its status information to nearby devices, including MAC address, channel, switch status, and capacitor voltage. Pressing the button briefly will first toggle the switch state, then broadcast the updated status. The main controller running this example program will scan and read these broadcasts, format the information, and print it to the serial port (nothing is displayed on the controller's screen), as shown:

Controlling the Switch

First, obtain the MAC address of the SwitchC6 from the sticker or from the broadcast information.

Open the Controller example program included in the M5SwitchC6-ESP-NOW library, enter the MAC address (format: XXXX-XXXX-XXXX) of the SwitchC6 you want to control, along with the Wi-Fi SSID and password for the host, then compile and upload.

Tap the left button on the main controller's screen to turn on the switch, the middle button to turn it off, and the right button to query the switch status.

3.API

On This Page