BarGraph
Simple code to turn a percentage (0.0 - 1.0, e.g. AnalogIn) to a bargraph (e.g. leds) using BusOut and some maths...
#include "mbed.h" BusOut leds(LED1, LED2, LED3, LED4); AnalogIn sound(p18); int main() { while(1) { leds = (1 << (int)(sound * 5.0)) - 1; } }
