![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
clge exp1
Diff: aandb.cpp
- Revision:
- 0:76c61fcbd486
- Child:
- 1:ef00f07599d7
diff -r 000000000000 -r 76c61fcbd486 aandb.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/aandb.cpp Thu Jun 11 10:01:07 2015 +0000 @@ -0,0 +1,62 @@ +#include "mbed.h" + +DigitalOut a(LED1); +DigitalOut b(LED2); +DigitalOut c(LED3); +DigitalOut d(LED4); +int main() { + while(1) { + int q=0,w=2,e; + e=(q-w)^2; + switch(e) + { + case 1: + a=0;b=0;c=0;d=1; + wait(0.2);break; + case 2: + a=0;b=0;c=1;d=0; + wait(0.2);break; + case 3: + a=0;b=0;c=1;d=1; + wait(0.2);break; + case 4: + a=0;b=1;c=0;d=0; + wait(0.2);break; + case 5: + a=0;b=1;c=0;d=1; + wait(0.2);break; + case 6: + a=0;b=1;c=1;d=0; + wait(0.2);break; + case 7: + a=0;b=1;c=1;d=1; + wait(0.2);break; + case 8: + a=1;b=0;c=0;d=0; + wait(0.2);break; + case 9: + a=1;b=0;c=0;d=1; + wait(0.2);break; + case 10: + a=1;b=0;c=1;d=1; + wait(0.2);break; + case 11: + a=1;b=0;c=1;d=1; + wait(0.2);break; + case 12: + a=1;b=1;c=0;d=0; + wait(0.2);break; + case 13: + a=1;b=1;c=0;d=1; + wait(0.2);break; + case 14: + a=1;b=1;c=1;d=0; + wait(0.2);break; + case 15: + a=1;b=1;c=1;d=1; + wait(0.2);break; + + } + + } +} \ No newline at end of file