VT3 Marko_Artic
Dependencies: mbed
main.cpp
00001 #include "mbed.h" 00002 BusOut myleds(LED4, LED3, LED2, LED1); 00003 char x=1; 00004 int main() 00005 { 00006 while(1) { 00007 for(int i=0; i<3; i++) { // x = a << b then x = a*2^b; 00008 x = x << 1; // x=1,2,4,8 or x=0001,0010,0100,1000 00009 myleds=x; // sweep left 00010 wait(0.2); 00011 } 00012 for(int i=0; i<3; i++) { // x = a >> b then x = a/2^b; 00013 x = x >> 1; // x=8,4,2,1 or x=1000,0100,0010,0001 00014 myleds=x; // sweep right 00015 wait(0.2); 00016 } 00017 } 00018 }
Generated on Sat Jul 16 2022 02:06:00 by 1.7.2