Joshua Waters
/
ShiftBrite_HelloWorld
ShiftBrite control class Hello World program
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "ShiftBrite.h" 00003 00004 //ShiftBrite Demo 00005 //DigitalOut latch(p15); 00006 //DigitalOut enable(p16); 00007 //Cycles through different colors on RGB LED 00008 SPI spi(p11, p12, p13); 00009 00010 ShiftBrite myBrite(p15,p16,spi); //latch, enable, spi 00011 00012 int main() { 00013 int r,g,b; 00014 r=g=b=50; 00015 00016 while(1) { 00017 myBrite.Write(255,255,255); 00018 wait(0.5); 00019 myBrite.Write(0,0,255); 00020 wait(0.5); 00021 myBrite.Write(0,255,0); 00022 wait(0.5); 00023 myBrite.Write(255,0,0); 00024 wait(0.5); 00025 00026 myBrite.Brightness(r,g,b); 00027 if(r<1023) 00028 r+=50; 00029 else 00030 r=50; 00031 g=b=r; 00032 00033 } 00034 }
Generated on Tue Jul 12 2022 20:40:30 by 1.7.2