ShiftBrite control class Hello World program

Dependencies:   ShiftBrite mbed

main.cpp

Committer:
jwaters9
Date:
2014-11-03
Revision:
0:ab368b7d8765

File content as of revision 0:ab368b7d8765:

#include "mbed.h"
#include "ShiftBrite.h"

//ShiftBrite Demo
//DigitalOut latch(p15);
//DigitalOut enable(p16);
//Cycles through different colors on RGB LED
SPI spi(p11, p12, p13);

ShiftBrite myBrite(p15,p16,spi); //latch, enable, spi

int main() {
int r,g,b;
r=g=b=50;
    
    while(1) {
        myBrite.Write(255,255,255);
        wait(0.5);
        myBrite.Write(0,0,255);
        wait(0.5);
        myBrite.Write(0,255,0);
        wait(0.5);
        myBrite.Write(255,0,0);
        wait(0.5);
        
        myBrite.Brightness(r,g,b);
        if(r<1023)
            r+=50;
        else
            r=50;
        g=b=r;
        
    }
}