AMS, Franklin Lightning Sensor "AS3935" Library
You are viewing an older revision! See the latest version
Homepage
Franklin Lightning Sensor¶
AS3935
Sample¶
for LPC1114
main.cpp
#include "mbed.h" #include "AS3935.h" Serial pc(USBTX, USBRX); DigitalOut led1(LED1); I2C i2c(dp5, dp27); AS3935 as(i2c, dp26); 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); } }