For Sharp GP2Y0E03(optical distance measurement sensor).

#include "mbed.h"
#include "MjGP2Y0E03.h"

using namespace matsujirushi;

Serial pc(USBTX, USBRX);
I2C i2c(dp5, dp27);
MjGP2Y0E03 distanceSensor(&i2c, 0x80);

int main()
{
    pc.baud(115200);
    i2c.frequency(400000);
    for(;;)
    {
        uint16_t distance = distanceSensor.getDistance();
        
        pc.printf("%4d [", distance);
        int i;
        for (i = 0; i < distance / 50; i++)
        {
            pc.putc('*');
        }
        for (; i < 4096 / 50; i++)
        {
            pc.putc(' ');
        }
        pc.puts("]\r\n");
        
        wait_ms(50);
    }
}

unknown revision 'shortlog'