-
Notifications
You must be signed in to change notification settings - Fork 0
/
greenstem_2.ino
executable file
·60 lines (46 loc) · 1.36 KB
/
greenstem_2.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// Simple example showing how to set the Watchdog Time to wake up the Arduino
//
// **** INCLUDES *****
#include "SleepyPi.h"
#include <Time.h>
#include <LowPower.h>
#include <DS1374RTC.h>
#include <Wire.h>
const int LED_PIN = 13;
void setup() {
// Configure "Standard" LED pin
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN,LOW); // Switch off LED
// initialize serial communication: In Arduino IDE use "Serial Monitor"
Serial.begin(57600);
}
void loop() {
// Enter idle state for 8 s with the rest of peripherals turned off
for (int i=0; i<=225; i++) {
SleepyPi.idle(SLEEP_8S, ADC_OFF, TIMER2_OFF, TIMER1_OFF, TIMER0_OFF,
SPI_OFF, USART0_OFF, TWI_OFF);
}
// Do something here
// Example: Read sensor, data logging, data transmission.
SleepyPi.enablePiPower(true);
SleepyPi.enableExtPower(true);
digitalWrite(LED_PIN,HIGH); // Switch on LED
delay(500);
digitalWrite(LED_PIN,LOW); // Switch off LED
for (int j=0; j<=5; j++) {
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.print(sensorValue);
Serial.print(',');
Serial.print(sensorValue);
Serial.print(',');
Serial.print(sensorValue);
Serial.print(',');
Serial.print("60");
Serial.print(',');
Serial.println("4900");
delay(60000);// Wait a minute before next reading
}
SleepyPi.enablePiPower(false);
}