sketch_sep19b:2: error: 'Morse' does not name a type
sketch_sep19b.cpp: In function 'void loop()':
sketch_sep19b:10: error: 'morse' was not declared in this scope
I'm using Arduino 1.0.1, and have manually created all of the files & directory as well as downloaded the zip file at the end of the tutorial. In both cases, the same error message results.
So, either I'm doing something in error, or the 5 year old tutorial needs to be updated.
Post the code that's generating those error message, and I'm sure you'll get all the hope you need. Without the code, any help provided will just be shots in the dark.
And here's the header file (Morse.h) from the website:
/*
Morse.h - Library for flashing Morse code.
Created by David A. Mellis, November 2, 2007.
Released into the public domain.
*/
#ifndef Morse_h
#define Morse_h
#include "Arduino.h"
class Morse
{
public:
Morse(int pin);
void dot();
void dash();
private:
int _pin;
};
#endif
And finally, here's the C++ file, also from the website:
/*
Morse.cpp - Library for flashing Morse code.
Created by David A. Mellis, November 2, 2007.
Released into the public domain.
*/
#include "Arduino.h"
#include "Morse.h"
Morse::Morse(int pin)
{
pinMode(pin, OUTPUT);
_pin = pin;
}
void Morse::dot()
{
digitalWrite(_pin, HIGH);
delay(250);
digitalWrite(_pin, LOW);
delay(250);
}
void Morse::dash()
{
digitalWrite(_pin, HIGH);
delay(1000);
digitalWrite(_pin, LOW);
delay(250);
}
I reverted back to Arduino 1.0 and the sketch compiles. NB, I did have to edit the header file contained in the ZIP file - Wprogram.h to Arduino.h. It would be nice to get the tutorials current with the latest release.
The files are in the arduino-1.0.1\libraries\Morse directory. I'm using Windows 7.
bpospick:
The files are in the arduino-1.0.1\libraries\Morse directory.
That's at least part of your problem. Third-party libraries are to be installed in the libraries subdirectory of your sketchbook folder (My Documents\Arduino\ or something similar under Windows, I believe), not in the Arduino program folder. See Libraries - Arduino Reference under the heading "Contributed Libraries" for more information.