publish libraries to avoid users to have to download them one by one
This commit is contained in:
1 parent
93c075e880
commit
f0546fab8c
396 files changed
+536928
No files matched your search
@@ -0,0 +1,68 @@
|
||||
// Sample RFM69 sender/node sketch for motion sensor
|
||||
// PIR motion sensor connected to D3 (INT1)
|
||||
// When RISE happens on D3, the sketch transmits a "MOTION" msg to receiver Moteino and goes back to sleep
|
||||
// In sleep mode, Moteino + PIR motion sensor use about ~78uA
|
||||
// Library and code by Felix Rusu - felix@lowpowerlab.com
|
||||
// Get the RFM69 and SPIFlash library at: https://github.com/LowPowerLab/
|
||||
|
||||
#include <RFM69.h> //get it here: https://www.github.com/lowpowerlab/rfm69
|
||||
#include <SPI.h> //get it here: https://github.com/lowpowerlab/spiflash
|
||||
#include <LowPower.h> //get library from: https://github.com/LowPowerLab/LowPower
|
||||
|
||||
#define NODEID 18 //unique for each node on same network
|
||||
#define NETWORKID 100 //the same on all nodes that talk to each other
|
||||
#define GATEWAYID 1
|
||||
//Match frequency to the hardware version of the radio on your Moteino (uncomment one):
|
||||
//#define FREQUENCY RF69_433MHZ
|
||||
//#define FREQUENCY RF69_868MHZ
|
||||
#define FREQUENCY RF69_915MHZ
|
||||
#define ENCRYPTKEY "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
|
||||
//#define IS_RFM69HW //uncomment only for RFM69HW! Leave out if you have RFM69W!
|
||||
#define ACK_TIME 30 // max # of ms to wait for an ack
|
||||
#define LED 9 // Moteinos have LEDs on D9
|
||||
#define SERIAL_BAUD 115200
|
||||
#define MOTIONPIN 1 //hardware interrupt 1 (D3)
|
||||
|
||||
RFM69 radio;
|
||||
volatile boolean motionDetected=false;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(SERIAL_BAUD);
|
||||
radio.initialize(FREQUENCY,NODEID,NETWORKID);
|
||||
#ifdef IS_RFM69HW
|
||||
radio.setHighPower(); //uncomment only for RFM69HW!
|
||||
#endif
|
||||
radio.encrypt(ENCRYPTKEY);
|
||||
attachInterrupt(MOTIONPIN, motionIRQ, RISING);
|
||||
char buff[50];
|
||||
sprintf(buff, "\nTransmitting at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915);
|
||||
Serial.println(buff);
|
||||
}
|
||||
|
||||
void motionIRQ()
|
||||
{
|
||||
motionDetected=true;
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if (motionDetected)
|
||||
{
|
||||
if (radio.sendWithRetry(GATEWAYID, "MOTION", 6))
|
||||
{
|
||||
Serial.println(" ok!");
|
||||
Blink(LED,3);
|
||||
}
|
||||
else Serial.println(" nothing...");
|
||||
motionDetected=false;
|
||||
}
|
||||
radio.sleep();
|
||||
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
|
||||
}
|
||||
|
||||
void Blink(byte PIN, int DELAY_MS)
|
||||
{
|
||||
pinMode(PIN, OUTPUT);
|
||||
digitalWrite(PIN,HIGH);
|
||||
delay(DELAY_MS);
|
||||
digitalWrite(PIN,LOW);
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
@@ -0,0 +1,26 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="141.7mm" height="110.7mm" viewBox = " 0 0 502.087027 392.244417" >
|
||||
<!-- Front-->
|
||||
<g transform="translate(22.5000185, 22.5000185) " >
|
||||
<polygon style="stroke:#000000; fill:none; stroke-width:0.90000074" points="0, 0 24.80317, 0 24.80317, 10.62993 49.60634, 10.62993 49.60634, 0 74.40951000000001, 0 74.40951000000001, 10.62993 99.21268, 10.62993 99.21268, 0 124.01585, 0 124.01585, 29.2323075 113.38592, 29.2323075 113.38592, 58.464615 124.01585, 58.464615 124.01585, 79.724475 113.38592, 79.724475 113.38592, 108.9567825 124.01585, 108.9567825 124.01585, 138.18909 99.21268, 138.18909 99.21268, 127.55915999999999 74.40951000000001, 127.55915999999999 74.40951000000001, 138.18909 49.60634, 138.18909 49.60634, 127.55915999999999 24.80317, 127.55915999999999 24.80317, 138.18909 0, 138.18909 0, 108.9567825 10.62993, 108.9567825 10.62993, 79.724475 0, 79.724475 0, 58.464615 10.62993, 58.464615 10.62993, 29.2323075 0, 29.2323075 "/>
|
||||
</g>
|
||||
<!-- Back-->
|
||||
<g transform="translate(146.5158685, 22.5000185) " >
|
||||
<polygon style="stroke:#000000; fill:none; stroke-width:0.90000074" points="0, 0 24.80317, 0 24.80317, 10.62993 49.60634, 10.62993 49.60634, 0 74.40951000000001, 0 74.40951000000001, 10.62993 99.21268, 10.62993 99.21268, 0 124.01585, 0 124.01585, 29.2323075 113.38592, 29.2323075 113.38592, 58.464615 124.01585, 58.464615 124.01585, 79.724475 113.38592, 79.724475 113.38592, 108.9567825 124.01585, 108.9567825 124.01585, 138.18909 99.21268, 138.18909 99.21268, 127.55915999999999 74.40951000000001, 127.55915999999999 74.40951000000001, 138.18909 49.60634, 138.18909 49.60634, 127.55915999999999 24.80317, 127.55915999999999 24.80317, 138.18909 0, 138.18909 0, 108.9567825 10.62993, 108.9567825 10.62993, 79.724475 0, 79.724475 0, 58.464615 10.62993, 58.464615 10.62993, 29.2323075 0, 29.2323075 "/>
|
||||
</g>
|
||||
<!-- Left-->
|
||||
<g transform="translate(270.53171849999995, 22.5000185) " >
|
||||
<polygon style="stroke:#000000; fill:none; stroke-width:0.90000074" points="10.62993, 0 36.3189275, 0 36.3189275, 10.62993 72.637855, 10.62993 72.637855, 0 93.897715, 0 93.897715, 10.62993 115.15757500000001, 10.62993 115.15757500000001, 0 136.417435, 0 136.417435, 10.62993 172.73636249999998, 10.62993 172.73636249999998, 0 198.42535999999998, 0 198.42535999999998, 29.2323075 209.05528999999999, 29.2323075 209.05528999999999, 58.464615 198.42535999999998, 58.464615 198.42535999999998, 79.724475 209.05528999999999, 79.724475 209.05528999999999, 108.9567825 198.42535999999998, 108.9567825 198.42536, 138.18909 172.73636249999998, 138.18909 172.73636249999998, 127.55915999999999 136.417435, 127.55915999999999 136.417435, 138.18909 115.15757500000001, 138.18909 115.15757500000001, 127.55915999999999 93.897715, 127.55915999999999 93.897715, 138.18909 72.637855, 138.18909 72.637855, 127.55915999999999 36.3189275, 127.55915999999999 36.3189275, 138.18909 10.62993, 138.18909 10.62993, 108.9567825 0, 108.9567825 0, 79.724475 10.62993, 79.724475 10.62993, 58.464615 0, 58.464615 0, 29.2323075 10.62993, 29.2323075 "/>
|
||||
</g>
|
||||
<!-- Right-->
|
||||
<g transform="translate(270.53171849999995, 160.6891085) " >
|
||||
<polygon style="stroke:#000000; fill:none; stroke-width:0.90000074" points="10.62993, 0 36.3189275, 0 36.3189275, 10.62993 72.637855, 10.62993 72.637855, 0 93.897715, 0 93.897715, 10.62993 115.15757500000001, 10.62993 115.15757500000001, 0 136.417435, 0 136.417435, 10.62993 172.73636249999998, 10.62993 172.73636249999998, 0 198.42535999999998, 0 198.42535999999998, 29.2323075 209.05528999999999, 29.2323075 209.05528999999999, 58.464615 198.42535999999998, 58.464615 198.42535999999998, 79.724475 209.05528999999999, 79.724475 209.05528999999999, 108.9567825 198.42535999999998, 108.9567825 198.42536, 138.18909 172.73636249999998, 138.18909 172.73636249999998, 127.55915999999999 136.417435, 127.55915999999999 136.417435, 138.18909 115.15757500000001, 138.18909 115.15757500000001, 127.55915999999999 93.897715, 127.55915999999999 93.897715, 138.18909 72.637855, 138.18909 72.637855, 127.55915999999999 36.3189275, 127.55915999999999 36.3189275, 138.18909 10.62993, 138.18909 10.62993, 108.9567825 0, 108.9567825 0, 79.724475 10.62993, 79.724475 10.62993, 58.464615 0, 58.464615 0, 29.2323075 10.62993, 29.2323075 "/>
|
||||
</g>
|
||||
<!-- Top-->
|
||||
<g transform="translate(22.5000185, 160.6891085) " >
|
||||
<polygon style="stroke:#000000; fill:none; stroke-width:0.90000074" points="10.62993, 10.62993 24.80317, 10.62993 24.80317, 0 49.60634, 0 49.60634, 10.62993 74.40951000000001, 10.62993 74.40951000000001, 0 99.21268, 0 99.21268, 10.62993 113.38592, 10.62993 113.38592, 36.3189275 124.01585, 36.3189275 124.01585, 72.637855 113.38592, 72.637855 113.38592, 93.897715 124.01585, 93.897715 124.01585, 115.15757500000001 113.38592, 115.15757500000001 113.38592, 136.417435 124.01585, 136.417435 124.01585, 172.73636249999998 113.38592, 172.73636249999998 113.38592, 198.42535999999998 99.21268, 198.42535999999998 99.21268, 209.05528999999999 74.40951000000001, 209.05528999999999 74.40951000000001, 198.42535999999998 49.60634, 198.42535999999998 49.60634, 209.05528999999999 24.80317, 209.05528999999999 24.80317, 198.42535999999998 10.62993, 198.42536 10.62993, 172.73636249999998 0, 172.73636249999998 0, 136.417435 10.62993, 136.417435 10.62993, 115.15757500000001 0, 115.15757500000001 0, 93.897715 10.62993, 93.897715 10.62993, 72.637855 0, 72.637855 0, 36.3189275 10.62993, 36.3189275 "/>
|
||||
<circle cx="62.007925" cy="77.95282" r="39.8622375" style="stroke:#000000;stroke-width:0.90000074;fill:none" />
|
||||
</g>
|
||||
<!-- Bottom-->
|
||||
<g transform="translate(146.5158685, 160.6891085) " >
|
||||
<polygon style="stroke:#000000; fill:none; stroke-width:0.90000074" points="10.62993, 10.62993 24.80317, 10.62993 24.80317, 0 49.60634, 0 49.60634, 10.62993 74.40951000000001, 10.62993 74.40951000000001, 0 99.21268, 0 99.21268, 10.62993 113.38592, 10.62993 113.38592, 36.3189275 124.01585, 36.3189275 124.01585, 72.637855 113.38592, 72.637855 113.38592, 93.897715 124.01585, 93.897715 124.01585, 115.15757500000001 113.38592, 115.15757500000001 113.38592, 136.417435 124.01585, 136.417435 124.01585, 172.73636249999998 113.38592, 172.73636249999998 113.38592, 198.42535999999998 99.21268, 198.42535999999998 99.21268, 209.05528999999999 74.40951000000001, 209.05528999999999 74.40951000000001, 198.42535999999998 49.60634, 198.42535999999998 49.60634, 209.05528999999999 24.80317, 209.05528999999999 24.80317, 198.42535999999998 10.62993, 198.42536 10.62993, 172.73636249999998 0, 172.73636249999998 0, 136.417435 10.62993, 136.417435 10.62993, 115.15757500000001 0, 115.15757500000001 0, 93.897715 10.62993, 93.897715 10.62993, 72.637855 0, 72.637855 0, 36.3189275 10.62993, 36.3189275 "/>
|
||||
</g></svg>
|
||||
|
After Width: | Height: | Size: 6.6 KiB |
Reference in new issue
Block a user