← 返回
开发者工具 中文

Arduino

Develop Arduino projects avoiding common wiring, power, and code pitfalls.
开发Arduino项目,避免常见的接线、供电和代码陷阱。
ivangdavila ivangdavila 来源
开发者工具 clawhub v1.0.0 1 版本 99899.6 Key: 无需
★ 6
Stars
📥 1,870
下载
💾 60
安装
1
版本
#latest

概述

Voltage and Power Traps

  • 3.3V vs 5V logic mixing damages boards — ESP32 is 3.3V, Uno is 5V, level shifter required
  • USB provides max 500mA — not enough for motors, servos, or many LEDs
  • Never power motors from Arduino 5V pin — use external supply with common ground
  • Brown-out causes random resets — looks like code bugs, actually insufficient power
  • Decoupling capacitors (0.1µF) near sensor power pins — reduces noise-related glitches

Wiring Mistakes

  • Floating inputs read random values — always use pullup or pulldown resistor
  • All components must share common ground — separate grounds = nothing works
  • Long wires pick up noise — keep analog sensor wires short
  • LEDs need current limiting resistors — direct connection burns LED and pin
  • Reversed polarity destroys components — double-check before powering on

Pin Conflicts

  • RX/TX pins (0, 1) conflict with Serial — avoid for GPIO when using Serial Monitor
  • Some pins have special functions — check board pinout for I2C, SPI, interrupt-capable pins
  • PWM only on pins marked with ~ — analogWrite() on wrong pin does nothing
  • Internal pullup available — INPUT_PULLUP eliminates external resistor for buttons

Timing Traps

  • delay() blocks everything — nothing else runs, no input reading, no interrupts serviced
  • millis() for non-blocking timing — compare against last action time
  • millis() overflows after ~50 days — use subtraction: millis() - lastTime >= interval
  • Interrupts for time-critical events — attachInterrupt() responds immediately

Memory Constraints

  • Uno has only 2KB RAM — large arrays fail silently with weird behavior
  • F() macro keeps strings in flash — Serial.println(F("text")) saves RAM
  • PROGMEM for constant arrays — keeps data out of RAM
  • String class fragments heap — prefer char arrays for stability

Serial Debugging

  • Baud rate must match — mismatch shows garbage, not an obvious error
  • Serial.begin() required in setup — output before this goes nowhere
  • Serial printing slows execution — remove or reduce for production code

Upload Problems

  • Wrong board selected — uploads but doesn't run correctly
  • Serial Monitor holds port — close before uploading
  • USB cable might be power-only — some cheap cables don't carry data
  • Bootloader corrupted — reflash using another Arduino as ISP

Sensor Communication

  • I2C devices share bus — check for address conflicts with scanner sketch
  • 5V sensors on 3.3V boards give wrong readings or damage — check operating voltage
  • SPI needs separate CS per device — can't share chip select lines

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-28 21:48 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,385 📥 321,022
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 72 📥 181,470
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 677 📥 325,912