月度归档: 2025 年 7 月

13 篇文章

Arduino获取红外信号
#include <Arduino.h> #define IR_PIN 2 void setup() { Serial.begin(115200); pinMode(IR_PIN, INPUT); } unsigned long pulseDuration(bool level) { unsigned long t = micros(); w…
Arduino按钮消抖
const int buttonPin = 2; // 按钮连接的引脚 const int ledPin = 13; // LED连接的引脚 int buttonState = HIGH; // 当前按钮状态 int lastButtonState = HIGH; // 上一次按钮状态 unsigned long lastDebounceTime …