Giter Club home page Giter Club logo

arduino-pwm-reader's Introduction

Arduino PWM Reader!

This library uses interrupts to read PWM values. It is capable of reading high pulse (normal pwm) or low pulse (inverted pwm). With upto 20 different PWM signals on supporting boards. To find the pins capable of 'CHANGE' external interrupts on your board, look at: https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/

Solo Example:

#include "PWM.hpp"

PWM my_pwm(2); // Setup pin 2 for PWM

void setup() {
    Serial.begin(115200); // Serial for debug
    my_pwm.begin(true); // PWM on pin 2 reading PWM HIGH duration
}

void loop() {
    Serial.print("Value: ");
    Serial.print(my_pwm.getValue());
    Serial.print("\tAGE: ");
    Serial.println(my_pwm.getAge());
    delay(100);
}

Multi Example:

#include "PWM.hpp"

PWM ch1(2); // Setup pin 2 for input
PWM ch2(3); // Setup pin 3 for input
PWM ch3(18); // Setup pin 18 for input
PWM ch4(19); // Setup pin 19 for input
PWM ch5(20); // Setup pin 20 for input
PWM ch6(21); // Setup pin 21 for input

void setup() {
    Serial.begin(115200); // Serial for debug
    ch1.begin(true); // ch1 on pin 2 reading PWM HIGH duration
    ch2.begin(true); // ch2 on pin 3 reading PWM HIGH duration
    ch3.begin(true); // ch3 on pin 18 reading PWM HIGH duration
    ch4.begin(true); // ch4 on pin 19 reading PWM HIGH duration
    ch5.begin(true); // ch5 on pin 20 reading PWM HIGH duration
    ch6.begin(true); // ch6 on pin 21 reading PWM HIGH duration
}

void loop() {
    Serial.print(ch1.getValue());
    Serial.print("\t");
    Serial.print(ch2.getValue());
    Serial.print("\t");
    Serial.print(ch3.getValue());
    Serial.print("\t");
    Serial.print(ch4.getValue());
    Serial.print("\t");
    Serial.print(ch5.getValue());
    Serial.print("\t");
    Serial.print(ch6.getValue());
    Serial.print("\t");
    Serial.println();
    delay(100);
}

paypal.me/xkam1x

arduino-pwm-reader's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

arduino-pwm-reader's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.