Hello,
I am using the Teensy 3.2 with the Adafruit 4 coin counter. I am powering it up correctly, and I have programmed it. The Adafruit has a wire "COIN" which is triggered and held high when a correct coin goes through. However, I am not able to detect this, I'm wondering is it a software issue or perhaps something with the hardware?
here is my code, I have tried using "pulseIn", and without interrupts but nothing seems to work.:
#define COIN 22
#define led 13
int coins;
void setup() {
// put your setup code here, to run once:
pinMode (COIN,INPUT);
pinMode (led,OUTPUT);
Serial.begin(115200);
attachInterrupt(COIN, isrService, RISING);
delay(500);
coins = 0;
}
void loop()
{
digitalWrite(led,LOW);
}
// watermark generates this interrupt
void isrService()
{
cli();
Serial.println("At ISR0");
coins++
digitalWrite(led,HIGH);
delay(300);
digitalWrite(COIN,LOW);
sei();
}
I am using the Teensy 3.2 with the Adafruit 4 coin counter. I am powering it up correctly, and I have programmed it. The Adafruit has a wire "COIN" which is triggered and held high when a correct coin goes through. However, I am not able to detect this, I'm wondering is it a software issue or perhaps something with the hardware?
here is my code, I have tried using "pulseIn", and without interrupts but nothing seems to work.:
#define COIN 22
#define led 13
int coins;
void setup() {
// put your setup code here, to run once:
pinMode (COIN,INPUT);
pinMode (led,OUTPUT);
Serial.begin(115200);
attachInterrupt(COIN, isrService, RISING);
delay(500);
coins = 0;
}
void loop()
{
digitalWrite(led,LOW);
}
// watermark generates this interrupt
void isrService()
{
cli();
Serial.println("At ISR0");
coins++
digitalWrite(led,HIGH);
delay(300);
digitalWrite(COIN,LOW);
sei();
}