:: Code Library and Tutorials ::
This code is not specific to any external devices. Code for that is found in InterfacingWithHardware. Here you find general use software snippets and libraries for calculations and 'internal' purposes.
Code Snippets and Utility Libraries.
AVR Related
Protothreading, Timing & Millis
- Metro Lib: Implementation of recurring timed events like blinking LEDs or servo motor control
- TimedAction a resource-friendly library for Timed Actions that occur every x millisecond.
- DateTime library Software real time clock
- EventFuse: Recurring clocked events via a count-down fuse
- The Tween class for ramps (PWM fades, for instance)
- millis() rollover handling: a function for detecting and handling rollover of the millis() function.
- Prescaler-related utility library : easy get/set of the prescaler + alternative functions to millis() / delay()
- heartbeat sketch - use an array to create an irregular blink pattern
- Stopwatch: doing multiple things at the same time.
- Scheduler: Javascript timer functions ported to Arduino to call your functions when you want them to be called.
- DCF77: DCF77 Library v.0.1 beta - March 2010.
Input / Output
Storage
- RAM and EEPROM
- Read-only Flash ("PROGMEM") storage
- Mikal Hart's Flash library allows you to easily store strings, arrays, and tables in read-only memory without the hassle and complexity of learning PROGMEM programming.
- PROGMEM - top secret information too shocking to be included in the official reference section
Communication
- Serial
- Streaming output: A simple way to get <<-style output with Serial/LCD/Ethernet/etc.
- SerialDebugger is a library that ebhances code readability, and debug control.
- NewSoftSerial: An interrupt-driven alternative to the core SoftSerial library.
- SerialIP provides Internet connectivity over the serial port (no shields required)
- Twitter
General
- Unit Testing
- Resource Friendly Datastructures
- String Functions
- Behavior based programs
- Finite State Machine
Math
- Prime number generator
- Smoothing Functions
- smooth(data, filterVal, smoothedVal) - a low-pass filter smoothing function, useful for removing sensor jitter
- digitalSmooth(data, smoothArrayName) - a digital low-pass filter smoothing function, useful for removing sensor jitter, and glitches
- Mapping Functions
- autoscale - scale a variable between two ranges using linear interpolation
- fscale - a function to map a variable between two floating point ranges.
Has a parameter to logarithmically favor either end of the output range
- smoothstep - a function to ease from one value to the next with a smooth "s" shaped logarithmic curve.
- Random Functions
- randomHat() - choose every number from a "hat" before repeating
- randomWalk(stepSize) - wander between endpoints at a specified rate
- Frequency Related
- Frequency Generation
- Frequency Measurement
Tutorials and Resources
These aren't code for a particular function, but rather tutorials on various aspects of C/C++.
Navigation
AVR Related
- Let the arduino sleep.
- C language
- A very good summary of the C language (.pdf)
- Reference for the standard C API (libc).
To use with Arduino, add the appropriate #include to the top of your sketch and use the functions as documented in the manual.
- Variable Cope
- An explanation of the parts of a sketch that can "see" a particular variable. For example, some variables are global, some are contained within a particular function, etc. Variable Scope
- Port Manipulation
- More explanation of ports and manipulating them with bitwise operators.
Port Manipulation
Protothreading, Timing & Millis
- This section needs to be extended
Input / Output
Storage
Communication
General
- Library Creation
- Pointers
Math
- Bit Math Tutorial
- Learn how to decipher all those cryptic formulas you see in C code that use symbols like
&= and <<. Start using bitwise operators in your own code to save memory and perform sophisticated low-level operations on your microcontroller hardware.