Particle based animation with openFrameworks

Continuing on with my other particle based generative art, here’s an animation I made with openFrameworks.

A still:

sun

Particle based generative art with openFrameworks

I’ve recently started playing with openFrameworks and I have to say I’m very impressed. Having messed with Processing previously, openFrameworks doesn’t feel too alien. It does have a steeper learning curve than Processing but it you’ve programmed C++ before it shouldn’t be long until you can whip up your first masterpieces.

Last week I’ve created a very simple particle system and had each particle leave a trace as it was animated. The following images are variations on the same theme. They are pretty much the same program with a few changes made between each run.

The common thing in all of these is that the particle movement is governed by Perlin noise.

(click images for larger versions)

open_frameworks_01 open_frameworks_03 open_frameworks_04 open_frameworks_06 open_frameworks_07 open_frameworks_08 open_frameworks_10 open_frameworks_11 open_frameworks_12 open_frameworks_14 open_frameworks_16 open_frameworks_17

Calibrator: An Arduino library to calibrate sensors hooked to analog inputs

Once you get past your first few projects with the Arduino, you soon realize that the calibration method they show on their webpage is just a sample and cannot be used with many sensors without polluting your code with a ton of variables.

So, here it is. My own take on sensor calibration library. You can download the source code and a more detailed explanation on the github Calibrator page.

This is how you use it:

#include <Calibrator.h>

Calibrator calibrator;

int sensorPin = A0; // The sensor we want to calibrate
int ledPin = 13;    // Will indicate when calibration is going on

void setup()
{
    pinMode(ledPin, OUTPUT);
    digitalWrite(ledPin, HIGH); // Turn LED on
    Serial.begin(9600);

    // Reset the calibrator. You only need to call reset() if you restart calibration again but
    // if calibration is only run once like in this example is not needed. It doesn't hurt to 
    // call it here though. 
    calibrator.reset();

    // Run calibration automatically during the first 
    // five seconds (or 5000 milliseconds) your code runs.
    // It is important that during calibration you "exercise" your sensors to measure both 
    // ends of their range.
    while (millis() < 5000) {
        calibrator.setValue(analogRead(sensorPin));
    }
    digitalWrite(ledPin, LOW); // Turn LED off
}

void loop()
{
    // In your code analogRead(sensorPin) will give you the uncalibrated value
    // and calibrator.getValue(analogRead(sensorPin)) will give you the calibrated value 

    Serial.print("Sensor value: ");
    Serial.print(analogRead(sensorPin));
    Serial.print(" , Calibrator value: ");
    Serial.println(calibrator.getValue(analogRead(sensorPin)));
}