Trouble writing a library

I attempting to learn how to write libraries. It is just to learn and doesn't do much.
I have written a keyword file. a .cpp file and a .h file all with the name THMOD.(H/txt/cpp). I put the three files in a directory arduino/library/THMOD. To test, I closed Arduino and re-opened it, and I created a sketch with just the line "#include "THMOD.H". I get the message "sketch_feb19a.cpp:1:19: error: THMOD.H: No such file or directory". Do I need to compile the ccp file to a .o file and if so, with what program?
Jim

you can post the code of your libs and sample code.

A better place to put your libraries is in your code folder/libraries, see FILE-> preferences for the location.

Are you shure you killed all instances of the IDE?

robtillaart:
you can post the code of your libs and sample code.

A better place to put your libraries is in your code folder/libraries, see FILE-> preferences for the location.

Are you shure you killed all instances of the IDE?

I rebooted the computer!

h file

#######################

This is keywords for THMOD library

#######################
#infdef THMOD_H
#define THMOD_H
#include <WProgram.h>

class THMOD
public:
{
THMOD();
~THMOD();
float readC();
float readF();
float readH();
}
#endif

keyword file

#######################

Datatypes (KEYWORD 1)

#######################

#######################

Methods (KEYWORD2)

#######################
THMOD KEYWORD1
readC KEYWORD2
readF KEYWORD2
readH KEYWORD2

cpp file

/* this is an attempt to learn how to write libraries
by putting a wrapper around the SHT1x library
with shorter names*/
#include <SHT1x.h>
#include <math.h>
#include "THMOD.h" // include declaration

#define dataPin 4 // DATA
#define clockPin 5 // SCK
float temp_c;
float temp_f; float humidity;

//constructor
THMOD::THMOD()
{
SHT1x sht1x(dataPin, clockPin);
}
//destructor
THMOD::~THMOD() // nothing needed

float THMOD::readC()
{
temp_c = sht1x.readTemperatureC();
return temp_c;
}

float THMOD::readF()
{
temp_f = sht1x.readTemperatureF();
return temp_f;
}

float THMOD::readH()
{
humidity = sht1x.readHumidity();
return humidity;
}

All this does is give me easier names because my right arm is amputated and typing with just your left hand is not easy.
Jim

All this does is give me easier names because my right arm is amputated and typing with just your left hand is not easy.

I understand, for me that would mean less than half the speed, maybe even 1/4 th.
This might be something for you - http://www.footmouse.com/ - to consider. Would enable you to copy and paste faster after some exercise.
(there are probably more footmouses from different suppliers)

If you use Arduino 1.0 you should use something like:

#if ARDUINO < 100
#include <WProgram.h>
#else
#include <Arduino.h>
#endif

I recall that using libraries in a library on the Arduino platform have some issues. Think you have to include
#include <SHT1x.h>
#include <math.h>
in your main sketch too.

Hope this helpes.

robtillaart:

If you use Arduino 1.0 you should use something like:

#if ARDUINO < 100
#include <WProgram.h>
#else
#include <Arduino.h>
#endif

I recall that using libraries in a library on the Arduino platform have some issues. Think you have to include
#include <SHT1x.h>
#include <math.h>
in your main sketch too.

Hope this helpes.

I am using 022 until I hear all the libraries are sorted out.
Putting includes in main sketch no help!
jim

This might be something for you - http://www.footmouse.com/ - to consider. Would enable you to copy and paste faster after some exercise.
(there are probably more footmouses from different suppliers)

Just watched the promo. No comment about the style... oh, and that "song" at the end... :stuck_out_tongue:
But the product really looks interesting. In fact, it would be a cool idea for an Arduino project (mumble, mumble...)

I recall that using libraries in a library on the Arduino platform have some issues.

Can't find the link right now, but recently I've read a very good explanation of why every .h file used, even indirectly, must be included in the sketch too. The Arduino toolchain copies the sketch and all the used libs' source files (.h and .cpp) into a temp directory before starting the compilation. To find out which files needs to be copied, the sketch is scanned for #include statements. This scan doesn't extend to the #included files, though, so either a .h file is included by the .ino (or .pde) file, or it doesn't get copied to the temp dir, and doesn't exist for the compiler.
This has one advantage: you don't have hidden dependencies. You look at a sketch and you can see each and every lib that you'll need to compile it.

alfiesty:
I have written a keyword file. a .cpp file and a .h file all with the name THMOD.(H/txt/cpp). I put the three files in a directory arduino/library/THMOD.

Unless you make a typo when posting, you've got the directory wrong. It should be arduino/libraries/THMOD.

Iain