Pages: [1]   Go Down
Author Topic: #include <math.h>  (Read 4901 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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-
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26322
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What error does this return?
Code:
#include <math.h>
void loop ()
{}
void setup ()
{}
Logged

"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.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 134
Posts: 6760
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Offline Offline
Edison Member
*
Karma: 3
Posts: 1001
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <avr/interrupt.h>
#include "wiring.h"

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

duh on my part
Logged

Pages: [1]   Go Up
Jump to: