Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Homepage
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);
}
}