Lenovo LEGION Y545 Gaming Laptop

[Lenovo LEGION Y545 Gaming Laptop] $1200

[Charger]

[Order Charger]

[Manual]

RAM – [SAMSUNG M471A1K43CB1-CTD 8GB DDR4 2666MHz Memory Module – Memory Modules (8GB, 1 x 8GB, DDR4, 2666 MHz, 260-Pin SO-DIMM, Black, Green)]

Replacement Battery – [ZKROR L17M3PG2 57Wh 4955mAh Laptop Battery Replacement for Lenovo Legion Y7000-2019 Y545 Y540-15IRH Y530-15ICH-1060 Y7000P-1060 Series L17C3PG2 5B10W67380 5B10Q88555 5B10T31045 5B10W69457 11.52V]

Replacement Fans – [ZHAWULEEFB Replacement New CPU+GPU Cooling Fan for Lenovo Legion Y540P Y545 Y7000P-2019 FKTY FKU0 DFS501105PR0T-FKU0 DFS2001052Q0T-FKTY DC 5V 0.5A Fan]

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)));
})