Code fonctionnel pour le chenillard de led du phare GE1

Dependencies:   mbed LedStripGradient PololuLedStrip

main.cpp

Committer:
AlexisCollin
Date:
2020-03-13
Revision:
17:4cb4930316d9
Parent:
14:deec0e9c10a4

File content as of revision 17:4cb4930316d9:

#include "mbed.h"
#include "PololuLedStrip.h"

PololuLedStrip ledStrip(D9);

#define LED_COUNT 60
rgb_color colors[LED_COUNT];

Timer timer;

int main()
{
    uint8_t u=0;
    timer.start();

    while(1)
    {
        // Update the colors array.
        //uint8_t time = timer.read_ms() >> 2;
        for(uint32_t i = 0; i < LED_COUNT; i++)
        {
            //uint8_t x = time - 1*i;
            colors[i] = (rgb_color){ 0, 0, 0 };
        }
        
        colors[u] = (rgb_color){ 255, 255, 255 };
        u++;
        if(u>=LED_COUNT)u=0;
    
        // Send the colors to the LED strip.
        ledStrip.write(colors, LED_COUNT);
        wait_ms(15); 
    }
}