#include "mbed.h" #include "TextLCD.h" BusIn inputs (p5,p6,p7,p16); BusOut outputs(LED1,LED2,LED3,LED4); DigitalIn a(p5),b(p6),c(p7),d(p16) ; int I,O; int main() { a.mode(PullUp); b.mode(PullUp); c.mode(PullUp); d.mode(PullUp); while(1) { I=inputs; O=0; if(((I&7)==6)|| ((I&7)==1)) O=1; if(((I&15)==15)|| ((I&15)==8)) O=O|2; if((I&5)==1) O=O|4; if(((I&10)==8)|| ((I&12)==4)) O=O|8; outputs=O; } }