Arduino: Difference between revisions
Appearance
NickPGSmith (talk | contribs) |
NickPGSmith (talk | contribs) |
||
Line 37: | Line 37: | ||
== Hardware == | == Hardware == | ||
* Uno | * Uno R3 | ||
** [https://docs.arduino.cc/hardware/uno-rev3/ Uno] | ** [https://docs.arduino.cc/hardware/uno-rev3/ Uno] | ||
** [https://docs.platformio.org/en/latest/boards/atmelavr/uno.html PlatformIO] | ** [https://docs.platformio.org/en/latest/boards/atmelavr/uno.html PlatformIO] | ||
Line 43: | Line 43: | ||
** [https://docs.arduino.cc/hardware/micro/ Micro] | ** [https://docs.arduino.cc/hardware/micro/ Micro] | ||
** ? | ** ? | ||
** Direct USB -> can appear as mouse/keyboard | |||
* Nano | * Nano | ||
** [https://docs.arduino.cc/hardware/nano/ Nano] | ** [https://docs.arduino.cc/hardware/nano/ Nano] |
Revision as of 10:01, 19 September 2025
General
Startup & Programming
On reset or powerup, ehe Optiboot or other bootloader code is run. If an external reset was the cause, listening mode is entered, and the LED is flashed. Programming commands in STK500 protocol are listened for, of the serial line at 115200 speed. If none are received in a small timeout window (~ 1s), the normal code is executed.
The DTR line if used to trigger a reset pulse in software IDE (see here).
millis()
- Useful for timing without using a blocking delay()
- Returns ms in an unsigned long
- Test for 1s (subtraction correctly handles truncation/rollover):
- millis() - lastCounter > 1000
- https://arduino.stackexchange.com/questions/12587/how-can-i-handle-the-millis-rollover/12588#12588
Documentation
Useful Libraries
- FastLED for WS2812B programmable LED strips
- FreeRTOS
- LibPrintf
- LiquidCrystal_PCF8574 derived from Liquid Crystal
- OneButton
- Pin Change Interrupt
- TinyGPS
Hardware
- Uno R3
- Micro
- Micro
- ?
- Direct USB -> can appear as mouse/keyboard
- Nano
Development Environment
- Visual Studio Code, install Platform.io IDE extension
- Extension icon -> New Project
- include - header files
- lib - libraries
- src - C++ source files
- platformio.ini
- See small icons at bottom for Home, Build, Upload, Serial Monitor
- SHIFT-ALT-F to format document
Platformio.ini
- monitor_speed = 115200