:: 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
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.
- 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.