Skip to content

Instantly share code, notes, and snippets.

@tdnvl
Created May 16, 2017 03:40
Show Gist options
  • Save tdnvl/5c7725fe798749aa278927eaf1f3183d to your computer and use it in GitHub Desktop.
Save tdnvl/5c7725fe798749aa278927eaf1f3183d to your computer and use it in GitHub Desktop.
Code for the Phantom YoYo High Sensitivity Moisture Sensor with Low Power library (Arduino)
// Low Power library
#include "LowPower.h"
int moisturePin = A0;
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
void loop() {
// Sleep for 8s
LowPower.idle(SLEEP_8S, ADC_OFF, TIMER2_OFF, TIMER1_OFF, TIMER0_OFF, SPI_OFF, USART0_OFF, TWI_OFF);
int moisturePin = analogRead(A0);
Serial.println(moisturePin);
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment