summaryrefslogtreecommitdiff
path: root/tmk_core/tool/mbed/mbed-sdk/libraries/tests/mbed/i2c_SRF08/main.cpp
blob: 7923e926ff2f353fdcadd417b783e2efa7a1cb3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "mbed.h"
#include "SRF08.h"

DigitalOut led(LED1);

SRF08 srf08(p28, p27, 0xE0); // SDA, SCL pin and I2C address

int main() {
    printf("started\n");
    while (1) {
       printf("Measured range : %.2f cm\n",srf08.read());
       wait(1.0);
       led = !led;
    }
}