Meet Adafruit Founder Limor Fried: Open Source Hardware Revolution

[Circuit Playground Express]

[Make Code Adafruit]

Change from green to red based on sound loudness.

function lerp(start: number, end: number, amt: number) {
    return (1.0 - amt) * start + amt * end;
}
function lerpColor(from: number, to: number, t: number) {
    let red = Math.floor(lerp((from & 0xFF), (to & 0xFF), t));
    let green = Math.floor(lerp((from & 0xFF00) >> 8, (to & 0xFF00) >> 8, t));
    let blue = Math.floor(lerp((from & 0xFF0000) >> 16, (to & 0xFF0000) >> 16, t));
    let color = red | (green << 8) | (blue << 16);
    return color;
}
function getRed(color: number) {
    let red = (color & 0xFF);
    return red;
}
function getGreen(color: number) {
    let green = (color & 0xFF00) >> 8;
    return green;
}
function getBlue(color: number) {
    let blue = (color & 0xFF0000) >> 16;
    return blue;
}
forever(function () {
    let red = 0x0000FF;
    let green = 0x00FF00;
    light.setBrightness(10);

    let t = input.soundLevel() / 255.0;
    let color = lerpColor(red, green, 1.0 - t);

    light.setAll(light.rgb(getRed(color), getGreen(color), getBlue(color)));
})

Prototype This! TV Show in 2009

In a San Francisco Bay island warehouse, a crack team of engineers, PhD’s and a special effects wizard are inventing the future one prototype at a time. To solve the problems of today, the team imagines the craziest, one-of-a-kind prototypes of tomorrow, and then builds them. Join the PROTOTYPE THIS team on a journey through emerging technology as they invent the future.

[Prototype This!]