ESP32 Starter Kit
3. Wiring Diagram
3. Test Code
A counter includes three buttons: plus, minus, and reset(return to zero). We program “if” to determine the state of
button, “pressed” for execution. For better results, we need to add a 200ms delay.
/*
keyestudio ESP32 Inventor Learning Kit
Project 14 Counter
http://www.keyestudio.com
*/
#include "TM1650.h" //Upload TM1650 library file
int item = 0; //Displayed value
#define CLK 22 //pins definitions for TM1650 and can be changed to other ports
#define DIO 21
TM1650 DigitalTube(CLK,DIO);
int res = 17; //Reset button
int subtract = 18; //minus button
int add = 19; //plus button
void setup(){
(continues on next page)
8.5. Arduino Project 95