Ok so here is the deal,
Environment:
Compiled from Git Repo
Ubuntu x64
Last night I was successful at doing the blinking light tutorial using the sketch window. Now I want to create a C Library to do the Morse example. I am trying to do this in C instead of C++ but which I don't think should be that tough, but I am no expert. So I create the following in ./libraries/Morse
/*
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 <WProgram.h>
class Morse
{
public:
Morse(int pin);
void dot();
void dash();
private:
int _pin;
};
#endif
Morse.H
#include "WProgram.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);
}
Morse.c
Now comes the tricky part, first if I try to do what I want (which is compile using gcc Morse) I get the following...
jackie@jackie-Latitude-E6410:~/Development/Code/Arduino/libraries/Morse$ gcc Morse.c
Morse.c:1:22: fatal error: WProgram.h: No such file or directory
compilation terminated.
And if I use the sketch window I get the following...
[exec]
[exec]
[exec]
[exec]
[exec]
[exec]
[exec]
[exec]
[exec]
[exec]
[exec] In file included from /home/jackie/Development/Code/Arduino/build/linux/work/libraries/Morse/Morse.c:2:
[exec] /home/jackie/Development/Code/Arduino/build/linux/work/libraries/Morse/Morse.h:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Morse’
[exec] /home/jackie/Development/Code/Arduino/build/linux/work/libraries/Morse/Morse.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
[exec] /home/jackie/Development/Code/Arduino/build/linux/work/libraries/Morse/Morse.c:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
[exec] /home/jackie/Development/Code/Arduino/build/linux/work/libraries/Morse/Morse.c:18: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
Any ideas?
Thanks!