0
#include<PinChangeInt.h>
#define SensorPin 2

int ledPin = 10;
int BuzzerPin = 12;
volatile byte blip = 0;

void blipcount(){
  blip++;
};

void setup() {
   // put your setup code here, to run once:
   pinMode(SensorPin,INPUT);
   pinMode(ledPin,OUTPUT);
   pinMode(BuzzerPin,OUTPUT);
   PCintPort::attachInterrupt(SensorPin,blipCount,FALLING);
   Serial.begin(9600);
}

void loop() {
   // put your main code here, to run repeatedly:
   if(digitalRead(SensorPin)==HIGH){
      digitalWrite(ledPin,HIGH);
      digitalWrite(BuzzerPin,HIGH);
      Serial.print("blipcoun:\t");
      Serial.println(blip,DEC);
   }

   if(digitalRead(SensorPin)==LOW){
      digitalWrite(ledPin,LOW);
      digitalWrite(BuzzerPin,LOW);
   }
}

I am using arduino uno for a project.I need to record when my sensor gives a high value but i need it to read only falls in pulses.The program is giving error as

Arduino: 1.6.3 (Windows 8.1), Board: "Arduino Uno"

Sense.ino: In function 'void setup()':

Sense.ino:14:38: error: 'blipCount' was not declared in this scope

Error compiling

please tell me what is the problem with the function.

The library link is https://code.google.com/p/arduino-pinchangeint/downloads/list

tested the code on both 1.72 and 2.19

1
  • void blipcount(){ blip++; }; why the ; at the end of the function?
    – Paul
    Apr 15 '15 at 11:57
1

You have a typo:

PCintPort::attachInterrupt(SensorPin,blipCount,FALLING);

Should be:

PCintPort::attachInterrupt(SensorPin,blipcount,FALLING);
                                         ^

Note the lower-case "c".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.