Go Down

Topic: #include <math.h> (Read 5774 times) previous topic - next topic

SummitSeeker

Hello,

I am new to Arduino and electrical circuts as a whole but I am trying to get a thermistor to work with the Arduino and I have found some codes, but I cannot figure out how to include the #include <math.h> file or what I need to do to include it.  I went through all the library files on my Arduino window via sketch-> import library but the math.h file is not one of the available files.  I have searched everywhere but cannot figure it out.  Thanks to anone who can help.
-H-

AWOL

What error does this return?
Code: [Select]
#include <math.h>
void loop ()
{}
void setup ()
{}
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

SummitSeeker

hmmmm  I just insert this code into the Arduino sketch and compile right...?

I didn't get any error message but the math.h file isn't red like the other .h files...  is this right...?

If so maybe I have the thermistor set up wrong.  I have one wire to pos and a 10k ohm resistor to neg and the other side of resistor connecting to a horizontal line with the 0 pin and the other wire of the transistor.  

thanks for the help and such a quick reply too...

westfw

If it didn't give you an error, then it probably read math.h just fine.  You need to use the "import library" command for "third party" libraries from arduino-specific locations, but math.h is a standard C thing, and the compiler knows how to find it without any special help...

BenF

Quote
but math.h is a standard C thing, and the compiler knows how to find it without any special help...

It is also included by default - so there is no need to explicitly add the header to the main sketch file.

Here's a list of the standard headers included:
Code: [Select]

#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <avr/interrupt.h>
#include "wiring.h"

#ifdef __cplusplus
#include "HardwareSerial.h"
#endif


SummitSeeker

Thanks for the help guys...  I guess it was including the math.h file...

duh on my part

Go Up