`#include <Arduino.h> #include "TFT_eSPI.h" #include <SPI.h> // 定义 LED 所接的引脚 const int ledPin = 13; TFT_eSPI tft = TFT_eSPI(); // 初始化TFT_eSPI对象 void setup() { // 初始化数字引脚13为输出模式 pinMode(ledPin, OUTPUT); 串行.开始(115200); tft.init(); tft.setRota...
const int vibratorPin = 1; // "+" passive buzzer // Variables for managing vibrator timing unsigned long vibratorStartTime = 0; unsigned long vibratorCycleStartTime = 0; bool isVibratorOn = false; bool isVibratorActive = false; // Tracks whether the vibrator should be active // Start the...
The opposite will be readings on pin 6 which is connected via a pull-up resistor. Now we are sure that the push button will not be activated “by itself”. const int button1 = 7; const int button2 = 6; void setup() { pinMode(button1, INPUT); pinMode(button2, INPUT); ...
const int prisoner_counter_id = 0; // Prisoner state (been with lamp off or not) int prisoner_lookup[100]; // Number of counts by prisoner in charge of counting int prisoner_counter = 0; // State of the lamp int lamp = 0; // Current prisoner in the room int prisoner_room; mems...
const int doorUpSensor=4; int doorDownSensorState=0; int doorUpSensorState=0; int oldDoorUpSensorState=0; int oldDoorDownSensorState=0; int tmpState=0; int i=0; int pulseStep=1; int pulseBrightness=0; unsigned long blueLEDStartTime; ...
There is also a push button above the CPU socket, which is optional. In contrast to Goran'ssketchit is connected to the pulled-up /RESET pin of the Z80 CPU. A Schottky diode decouples the Arduino output from the switch, converting the push-pull output into a kind of open collector pul...