Hi, recently started learning Arduino by following a book. I usually figure out errors on my own, but got stuck on this one, so i figured to give it a try on here.
The error is: 'longBlink' was not declared in this scope.
// Include button library
#include <Button.h>
// Create a button object
Button btnSos(3);
const byte ledPin = 13;
void setup() {
// Start button
btnSos.begin();
// Use ledpin as output
pinMode(ledPin, OUTPUT);
}
void shortBlink() {
// Make a single short blink
digitalWrite(ledPin, HIGH);
delay(200);
digitalWrite(ledPin, LOW);
delay(200);
}
void longblink() {
// Make a single long blink
digitalWrite(ledPin, HIGH);
delay(600);
digitalWrite(ledPin, LOW);
delay(200);
}
void morseBlink(char character) {
// Translate character to Morse code
switch (character) {
case 's':
shortBlink();
shortBlink();
shortBlink();
break;
case 'o':
longBlink();
longBlink();
longBlink();
break;
}
}
void loop() {
// Start blinking SOS
if (!btnSos.released()) {
// Blink until btnSos is released
while (!btnSos.released()) {
morseBlink('s');
morseBlink('o');
morseBlink('s');
}
}
}
Error:
Sos.ino:42:7: error: 'longBlink' was not declared in this scope
longBlink();
^~~~~~~~~
C:\Users\siver\OneDrive\Dokumenter\Arduino\Sos.ino\Sos.ino.ino:42:7: note: suggested alternative: 'longblink'
longBlink();
^~~~~~~~~
longblink
exit status 1
'longBlink' was not declared in this scope