I've been working on an arduino project for school where we need to make a LED light up and such with an interrupt.
I wanted to test the code, but keep getting an error message. I've tried looking here in the forums for a solution, but there's nothing that's exactly like my problem.
const int ledPin = PA5; // On-board LED
const int buttonPin = PC13;
int blinkZeit = 1000;
int interruptCount = 0;
void buttonISR(){
blinkZeit /= 2;
interruptCount++;
Serial.print("Interrupt Count: ");
Serial.println(interruptCount);
Serial.print("BlinkZeit: ");
Serial.print(blinkZeit);
Serial.println(" ms.");
}
void setup() {
pinMode(buttonPin, INPUT_PULLDOWN);
pinMode(ledPin, OUTPUT);
attachInterrupt(digitalPinToInterrupt(buttonPin), buttonISR, RISING);
}
void loop() {
digitalWrite(ledPin, HIGH);
delay(blinkZeit/2);
digitalWrite(ledPin, LOW);
delay(blinkZeit/2);
}
Here's the error message I've been getting:
error: 'PA5' was not declared in this scope
const int ledPin = PA5; // On-board LED
note: suggested alternative: 'A5'
const int ledPin = PA5; // On-board LED
^~~
A5
I don't really understand why it's trying to get me to replace these pins when firstly, these have worked fine in previous projects and secondly, they are the pins I need to use for this project so I can't just change them.
error: 'PC13' was not declared in this scope
const int buttonPin = PC13;
^~~~
note: suggested alternative: 'PC1'
const int buttonPin = PC13;
^~~~
PC1
It also doesn't recognize the PULLDOWN for some reason. Like it doesn't highlight it in the programm either, but when i put PULLUP it does, which to me doesn't make sense.
error: 'INPUT_PULLDOWN' was not declared in this scope
pinMode(buttonPin, INPUT_PULLDOWN);
^~~~~~~~~~~~~~
note: suggested alternative: 'INPUT_PULLUP'
pinMode(buttonPin, INPUT_PULLDOWN);
^~~~~~~~~~~~~~
INPUT_PULLUP
exit status 1
'PA5' was not declared in this scope
If anyone could help out, that'd be great.