// connect 8 leds to port A
// connect 8 push button switches to port B
// press 0th switch --> 7th led should glow, ......7th switch ---> 0th led should glow
#include "ecen.h"
#include <math.h>
void setup() {
init_portA();
init_portB();
}
void loop() {
uint8_t val;
volatile long k;
uint8_t i = inputB();
val = log(i)/log(2.0);
if(i!=0) {outputA(0x80>>val);
for(k=0;k<=200000;k++);
}
else outputA(0x00);
}