Project

General

Profile

JeenodeMicroExample.cpp

Lahorde, 2014-02-24 10:34

 
1
// Do not remove the include below
2
#include "JeenodeMicroExample.h"
3
#include <logger.h>
4
#include <PinChangeInterrupt.h>
5
#include <JeeLib.h>
6

    
7

    
8
bool state = true;
9

    
10
void led()
11
{
12
  state = !state;
13
  digitalWrite(PIN_A0, state);
14
}
15

    
16
void setup() {
17
  pinMode(PIN_A0, OUTPUT);
18
  pinMode(PIN_A1, OUTPUT);
19

    
20
  /** Power up PIR */
21
  digitalWrite(PIN_A1, HIGH);
22
  /** 4s power up duration */
23
  delay(4000);
24

    
25
  /** Motion visual indication on LED */
26
  attachPcInterrupt(PIN_A7, led, RISING);
27
  digitalWrite(PIN_A0, state);
28
}
29

    
30
void loop() {
31
  // put your main code here, to run repeatedly:
32
  Sleepy::powerDown();
33
  //delay(100);
34
}