Arduino: Difference between revisions
Appearance
NickPGSmith (talk | contribs) |
NickPGSmith (talk | contribs) No edit summary |
||
(12 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. | |||
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]). | |||
* [https://docs.arduino.cc/retired/boards/arduino-duemilanove/ Duemilanove] | * [https://docs.arduino.cc/retired/boards/arduino-duemilanove/ Duemilanove] | ||
=== 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 == | == Documentation == | ||
Line 9: | Line 21: | ||
* [https://docs.arduino.cc/language-reference/ Arduino Language Reference] | * [https://docs.arduino.cc/language-reference/ Arduino Language Reference] | ||
== Libraries == | == Useful Libraries == | ||
* [https://www.arduino.cc/en/Reference/Libraries Standard Libraries] | * [https://www.arduino.cc/en/Reference/Libraries Standard Libraries] | ||
* [https://fastled.io/ FastLED] for WS2812B programmable LED strips | |||
** [https://fastled.io/docs/examples.html Code Examples] | |||
** [https://github.com/FastLED/FastLED/wiki/Pixel-reference Colour Reference] | |||
* [https://github.com/feilipu/Arduino_FreeRTOS_Library FreeRTOS] | |||
* [https://github.com/embeddedartistry/arduino-printf LibPrintf] | |||
* [https://github.com/mathertel/LiquidCrystal_PCF8574 LiquidCrystal_PCF8574] derived from [https://www.arduino.cc/en/Reference/LiquidCrystal Liquid Crystal] | * [https://github.com/mathertel/LiquidCrystal_PCF8574 LiquidCrystal_PCF8574] derived from [https://www.arduino.cc/en/Reference/LiquidCrystal Liquid Crystal] | ||
* [https:// | * [https://github.com/mathertel/OneButton OneButton] | ||
** [https:// | * [https://github.com/NicoHood/PinChangeInterrupt Pin Change Interrupt] | ||
* [https://github.com/neosarchizo/TinyGPS TinyGPS] | |||
== Other == | == Other == |
Latest revision as of 15:23, 22 August 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
Other
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