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.
You are viewing an older revision! See the latest version
Homepage
AMS, Franklin Lightning Sensor "AS3935" Library¶
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);
}
}