7 segmntni

Dependencies:   mbed

Committer:
lgotic
Date:
Thu Nov 17 18:59:34 2016 +0000
Revision:
1:5af0eee71624
Parent:
0:78994857dbda
V8.2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lgotic 0:78994857dbda 1 #include "mbed.h"
lgotic 1:5af0eee71624 2 BusOut myleds(LED4, LED3, LED2, LED1);
lgotic 1:5af0eee71624 3 char x=1;
lgotic 1:5af0eee71624 4 int main() {
lgotic 1:5af0eee71624 5 while(1) {
lgotic 1:5af0eee71624 6 for(int i=0; i<3; i++) { // x = a << b then x = a*2^b;
lgotic 1:5af0eee71624 7 x = x << 1; // x=1,2,4,8 or x=0001,0010,0100,1000
lgotic 1:5af0eee71624 8 myleds=x; // sweep left
lgotic 0:78994857dbda 9 wait(0.2);
lgotic 0:78994857dbda 10 }
lgotic 1:5af0eee71624 11 for(int i=0; i<3; i++) { // x = a >> b then x = a/2^b;
lgotic 1:5af0eee71624 12 x = x >> 1; // x=8,4,2,1 or x=1000,0100,0010,0001
lgotic 1:5af0eee71624 13 myleds=x; // sweep right
lgotic 1:5af0eee71624 14 wait(0.2);
lgotic 1:5af0eee71624 15 }
lgotic 1:5af0eee71624 16 }
lgotic 0:78994857dbda 17 }