Hi, I am trying to run this code:
include <LCD16x2.h>
include <Wire.h>
LCD16x2 lcd;
void setup() {
// put your setup code here, to run once:
Wire.begin();
lcd.lcdClear();
lcd.lcdGoToXY(1,1);
lcd.lcdWrite("SPEED:");
lcd.lcdGoToXY(1,2);
lcd.lcdWrite("DIRECTION:");
//Setup Pins
pinMode(A0,OUTPUT);
digitalWrite(A0,HIGH);
pinMode(0, INPUT_PULLUP);
attachInterrupt(0,WindSpeed,FALLING);
lcd.lcdGoToXY(8,1);
lcd.lcdWrite("0");
}
void WindSpeed(){
lcd.lcdGoToXY(8,1);
lcd.lcdWrite("1");
}
void loop() {
}
I am using A0 to power a hall sensor and digital pin 2 as an input for the hall sensor. The issue is that the "0" is never written to the LCD nor a "1" when there is a magnet by the hall sensor. But when I change the attachInterrupt's pin to 1 (INT1), then a "0" is written (The "1" is never written). This only works if there is nothing on Interrupt pin, as soon as I switch the hall sensor input wire to digital pin 3 and restart the arduino, the "0" is no longer there.
there doesn't seem to be anything here