Skip to main content
Include the linked content
Source Link
user31481
user31481

this library will let you attach a function to a pin using pin-change-interrupt, api is quite simple

https://github.com/neu-rah/PCINT#api

Arduino pin change interrupt library compatible with AVR and SAM with consistent interface.

Allows handlers to be called with a predefined cargo (void*) for user data or just regular void returning functions with no params.

This library use meta-programing to achieve consistency.

Example

#include <pcint.h>

#define led 13
#define btn 12

void setled() {
  digitalWrite(led,digitalRead(btn));
}

void setup() {
  pinMode(led,OUTPUT);
  pinMode(btn,INPUT_PULLUP);
  PCattachInterrupt<btn>(setled,CHANGE);
  setled();//initial led status
}

void loop() {}

API

Just two methods:

void PCattachInterrupt<pin>(userFunc,mode);
void PCdetachInterrupt<pin>();

this library will let you attach a function to a pin using pin-change-interrupt, api is quite simple

https://github.com/neu-rah/PCINT#api

this library will let you attach a function to a pin using pin-change-interrupt, api is quite simple

https://github.com/neu-rah/PCINT#api

Arduino pin change interrupt library compatible with AVR and SAM with consistent interface.

Allows handlers to be called with a predefined cargo (void*) for user data or just regular void returning functions with no params.

This library use meta-programing to achieve consistency.

Example

#include <pcint.h>

#define led 13
#define btn 12

void setled() {
  digitalWrite(led,digitalRead(btn));
}

void setup() {
  pinMode(led,OUTPUT);
  pinMode(btn,INPUT_PULLUP);
  PCattachInterrupt<btn>(setled,CHANGE);
  setled();//initial led status
}

void loop() {}

API

Just two methods:

void PCattachInterrupt<pin>(userFunc,mode);
void PCdetachInterrupt<pin>();
Source Link
neu-rah
  • 149
  • 5

this library will let you attach a function to a pin using pin-change-interrupt, api is quite simple

https://github.com/neu-rah/PCINT#api