AMS, Franklin Lightning Sensor "AS3935" Library

Franklin Lightning Sensor

雷(落雷)センサー AS3935 用のライブラリです。

Sample

I2C接続

for LPC1114

main.cpp

#include "mbed.h"
#include "AS3935.h"

Serial pc(USBTX, USBRX);
DigitalOut led1(LED1);

AS3935 as(dp5, dp27, dp26); // sda, scl, irq
//I2C i2c(dp5, dp27);
//AS3935 as(i2c, dp26); // i2c, irq

void lightning () {
    int energy, distance;
    as.read(energy, distance);
    pc.printf("Lightning energy=%d distance=%d\r\n", energy, distance);
}

int main() {
    pc.baud(115200);
    pc.printf("*** AS3935\r\n");
    as.init();
    as.attach(&lightning);
    for (;;) {
        led1 = ! led1;
        wait(0.2);
    }
}

no such method: docs