Jump to content

Arduino: Difference between revisions

From Smithnet Wiki
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
== General ==
== General ==
=== Startup & Programming ===


On reset or powerup, ehe [https://github.com/Optiboot/optiboot 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.
On reset or powerup, ehe [https://github.com/Optiboot/optiboot 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 in software IDE (see [https://rheingoldheavy.com/arduino-from-scratch-part-11-atmega328p-dtr-and-reset/ here]).
The DTR line if used to trigger a reset pulse in software IDE (see [https://rheingoldheavy.com/arduino-from-scratch-part-11-atmega328p-dtr-and-reset/ here]).
 
=== millis() ===


* [https://docs.arduino.cc/retired/boards/arduino-duemilanove/ Duemilanove]
* 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 ==
== Documentation ==


* [https://docs.arduino.cc/language-reference/ Arduino Language Reference]
* [https://docs.arduino.cc/language-reference/ Arduino Language Reference]
* [https://docs.arduino.cc/learn/programming/memory-guide/ Arduino Memory Guide]


== Useful Libraries ==
== Useful Libraries ==
Line 25: Line 34:
* [https://github.com/neosarchizo/TinyGPS TinyGPS]
* [https://github.com/neosarchizo/TinyGPS TinyGPS]


== Other ==
== Hardware ==
 
* [https://docs.arduino.cc/retired/boards/arduino-duemilanove/ Arduino Duemilanove]
** ATmega328 (16 MHz)
** [https://docs.platformio.org/en/stable/boards/atmelavr/diecimilaatmega328.html PlatformIO]
* [https://docs.arduino.cc/hardware/uno-rev3/ Arduino Uno R3]
** ATmega328P (16 MHz)
** [https://docs.platformio.org/en/latest/boards/atmelavr/uno.html PlatformIO]
* [https://www.sparkfun.com/pro-micro-5v-16mhz.html SparkFun Pro Micro]
** ATMEGA32U4 (16 MHz)
** [https://docs.platformio.org/en/latest/boards/atmelavr/sparkfun_promicro16.html PlatformIO]
** Direct USB -> can appear as mouse/keyboard
* [https://docs.arduino.cc/hardware/nano/ Arduino Nano]
** ATmega328PB (Micro USB) (16 MHz)
*** [https://docs.platformio.org/en/latest/boards/atmelavr/nanoatmega328.html PlatformIO]
** ATmega328PB (USBC) (16 MHz)
*** [https://docs.platformio.org/en/latest/boards/atmelavr/nanoatmega328new.html PlatformIO]
 
See: [https://wolles-elektronikkiste.de/en/atmega328pb-based-boards 328PB additions].


== Development Environment ==
== Development Environment ==
Line 42: Line 69:
=== Platformio.ini ===
=== Platformio.ini ===


* monitor_speed = 115200
Common additions:
lib_deps = fastled/FastLED@^3.10.3
monitor_speed = 115200
upload_port = COM3

Latest revision as of 08:15, 6 October 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()

Documentation

Useful Libraries

Hardware

See: 328PB additions.

Development Environment

  • SHIFT-ALT-F to format document

Platformio.ini

Common additions:

lib_deps = fastled/FastLED@^3.10.3
monitor_speed = 115200
upload_port = COM3