#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);
}
}
我正在使用arduino uno进行一个项目。我需要记录我的传感器何时给出一个很高的值,但我需要它只能读取脉冲。该程序给出了错误
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
请告诉我这个功能有什么问题。
图书馆链接是 https://code.google.com/p/arduino-pinchangeint/downloads/list
测试了1.72和2.19上的代码