PCINT | Yet another Arduino PCINT library

 by   neu-rah C++ Version: v4.0.8 License: No License

kandi X-RAY | PCINT Summary

kandi X-RAY | PCINT Summary

PCINT is a C++ library typically used in Internet of Things (IoT), Arduino applications. PCINT has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

Yet another Arduino PCINT library
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              PCINT has a low active ecosystem.
              It has 7 star(s) with 4 fork(s). There are 2 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 3 open issues and 3 have been closed. On average issues are closed in 53 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of PCINT is v4.0.8

            kandi-Quality Quality

              PCINT has 0 bugs and 0 code smells.

            kandi-Security Security

              PCINT has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              PCINT code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              PCINT does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              PCINT releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of PCINT
            Get all kandi verified functions for this library.

            PCINT Key Features

            No Key Features are available at this moment for PCINT.

            PCINT Examples and Code Snippets

            PCINT,Example
            C++dot img1Lines of Code : 17dot img1no licencesLicense : No License
            copy iconCopy
            #include 
            
            #define led 13
            #define btn 12
            
            void setled() {
              digitalWrite(led,digitalRead(btn));
            }
            
            void setup() {
              pinMode(led,OUTPUT);
              pinMode(btn,INPUT_PULLUP);
              PCattachInterrupt(setled,CHANGE);
              setled();//initial led status
            }
            
            void loop() {  
            PCINT,API,PCattachInterrupt
            C++dot img2Lines of Code : 1dot img2no licencesLicense : No License
            copy iconCopy
            void PCattachInterrupt(userFunc,mode);
              
            PCINT,API,PCdetachInterrupt
            C++dot img3Lines of Code : 1dot img3no licencesLicense : No License
            copy iconCopy
            void PCdetachInterrupt();
              

            Community Discussions

            QUESTION

            Best way to handle multiple PCINT in AVR
            Asked 2021-Nov-20 at 21:06

            I'm testing some things on a Attiny85 and thought about the best way to handle the interrupt rutine. I know it is bad to have a lot of code in the interrupt handler, but I'm uncertain of any other ways to do this. I want my main program to sleep and wake on PCINT, the PCINT comes from multiple pins (rotary encoder A, b & switch and a receiving UART) so I was thinking just having a lot of code in the handler.

            The code to determining which pin caused the interrupt, would look like this

            ...

            ANSWER

            Answered 2021-Nov-20 at 21:06
            volatile uint8_t flag;
            
            int main(void)
            {
                DDRB &= ~((1 << DDB0) | (1 << DDB1) | (1 << DDB2)); // Clear the PB0, PB1, PB2 pin
                // PB0,PB1,PB2 (PCINT0, PCINT1, PCINT2 pin) are now inputs
            
                PORTB |= ((1 << PORTB0) | (1 << PORTB1) | (1 << PORTB2)); // turn On the Pull-up
                // PB0, PB1 and PB2 are now inputs with pull-up enabled
            
                PCICR |= (1 << PCIE0);     // set PCIE0 to enable PCMSK0 scan
                PCMSK0 |= (1 << PCINT0);   // set PCINT0 to trigger an interrupt on state change 
            
                sei();                     // turn on interrupts
            
                while(1)
                {
                    gotosleep();
                    do
                    {
                        switch(flag)
                        {
                            case 1:
                                dosomething1();
                                break;
                            case 2:
                                dosomething2();
                                break;
                            case 3:
                                dosomething3();
                                break;
                        }
                    cli();
                    flag = 0;
                    sei();
                    }while(flag); 
            
                }
            }
            
            ISR (PCINT0_vect)
            {
                uint8_t changedbits;
            
                changedbits = PINB ^ portbhistory;
                portbhistory = PINB;
            
                if(changedbits & (1 << PB0))
                {
                    flag = 1;
                }
            
                if(changedbits & (1 << PB1))
                {
                    flag = 2;
                }
            
                if(changedbits & (1 << PB2))
                {
                    flag = 3;
                }
            }
            

            Source https://stackoverflow.com/questions/70049553

            QUESTION

            How to downsize code that uses DHT11 for AVR (Attiny45)
            Asked 2021-Nov-09 at 12:55

            I'm trying to build a small hygrometer based on the DHT11 and I'm having a bit of an "issue" with the code size. I want to run it on an Attiny45 and it's a wee bit too big (352 bytes too big to be exact). I am aware that I could just use an Attiny85 and have space to spare or don't use a bootloader and barely fit it in (94%) but I kind of want to make my life harder than it needs to be and figure out how to reduce size since it'll probably come in handy in the future. Treat it as a learning experience if you will.

            What it's supposed to do:

            • Read DHT11 input
            • Display results on 2 two-digit 7-segment displays (so I guess 4 7-segments in total)
            • Go to sleep most of the time to preserve battery
            • Wake up every 8 seconds to update sensor values (without turning on the display)
            • Wake up on a button press to display the values for humidity and temperature

            Side note: 7-segments are adressed via two 74HC595s of which I am using 7 outputs each for the displays and 1 each for a transistor that connects the display in question to GND. There's a schematic at the bottom if you're interested.

            As pointed out, my main issue is code size so if anyone has any tips on how to reduce that (or any other tips how to improve the code) please let me know.

            I hope I'm asking the question properly, if not please let me know.

            Compiler output:

            ...

            ANSWER

            Answered 2021-Nov-09 at 12:55

            Okay so thanks to the input of Mat I tried substituting the DHT11 library with something more sleek, which took me a while to get up and running. I ended up using this as a base, edited around a bit and commented heavily for my benefit. I added my updated code below for anyone interested (thanks for pointing out the correct highlighting issue), there's also a github with the rest of the design files.

            Seems the library is really heavy, as the compiler output shows:

            Compiler output:

            Source https://stackoverflow.com/questions/69867327

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install PCINT

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/neu-rah/PCINT.git

          • CLI

            gh repo clone neu-rah/PCINT

          • sshUrl

            git@github.com:neu-rah/PCINT.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link