This page lists code samples from the sensor reports. There are also a few general examples here as well. All major pieces of code for the wiki should be linked here.

A note on code on this wiki: If you use existing code from the code links here or elsewhere, please cite it and link to it. If you only make minor modifications, there's no need to post a whole new code sample. You can just make note of the change in your assignment summary. But if you come up with a significant improvement, please post it in the Code group of the Wiki and comment it well, so others may benefit.
tigoe & jamie

A Sample code Page Here are some notes on how your code samples should be formatted.


4dSystems xD Datalogger (Arduino-Processing)

Simple Datalogging directly to Computer


DosOnChip Module Example (Processing)

Another DosOnChip Module Example (Processing)


converting ADC readings to voltage (Arduino)

Running Average With Weighting (Arduino)

Three Sensors (Arduino-Processing)

Three Sensors, Call and Response (Arduino-Processing) - Taken from physcomp serial section

Three Sensors, Call/Response with Full String Messages (Arduino-Processing)

One Sensor Averaged (Arduino)

Three Sensors, one Averaged (Arduino-Processing)

Three Sensors, one Threshold (Arduino-Processing)

Three Sensors, one Threshold, two set Threshold (Arduino-Processing)


Using i2c with the CMP103 Compass Module

Simple SPI Communication without AVR Interrupts

TMP36 Temperature sensor {Arduino)

TMP102 temperature sensor using I2C {Arduino)

Thermistor 10k sensor - output in Fahrenheit and Celsius {Arduino)

Read the internal temperature sensor of an Atmega328 (Arduino)

Read the internal voltage sensor of an Atmega328 (Arduino)


Treshold-Based Trigger On/Off

Band-pass Filter by Average

Auto-Finding Ranges of Analog Sensor, Percentage Sending


External Code Resources

RCTime on an Arduino

Averaging (Smoothing) analog sensor readings (Arduino)

Calibrating analog sensor readings (Arduino)