Skip to content

An Arduino library to handle Pin Change Interrupts

Notifications You must be signed in to change notification settings

EnviroDIY/PcInt_PCINT0

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PcInt Library

This is an Arduino library to administrate and handle Pin Change Interrupts as needed to allow the Mayfly to sleep and save battery power.

This is modified from the Sodaq library to work properly with other libraries using pin change interrupts (SoftwareSerial and SDI-12 specifically.) This only makes use of PCINT0.

Examples

... TODO ... Here is a quick example to get you started

#include <Sodaq_PcInt.h>
void setup()
{
  pinMode(A0, INPUT_PULLUP);
  PcInt::attachInterrupt(A0, handleA0);
}

void loop()
{
  // ...
}

static uint8_t rain1ticks;
void handleA0()
{
  static bool rain1State;
  //rain counter 1
  if (digitalRead(A0) == LOW) {
    if (!rain1State) {
      rain1ticks++;
      rain1State = true;
    }
  } else {
    rain1State = false;
  }
}

Most important functions

  • PcInt::attachInterrupt

About

An Arduino library to handle Pin Change Interrupts

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 90.0%
  • Shell 10.0%