ERROR - too few arguments to function 'double pow(double, double)'

I am having problems when trying to compile this. the problem is in the line with the “wetbulb” equation.

const int critical = -3; //critcal plant freezing temp in degree C
const int led = 10; //soleniod relay  
float wetbulb = 0;
#include "DHT.h"

#define DHTPIN 3     // what digital pin we're connected to

// Uncomment whatever type you're using!
//#define DHTTYPE DHT11   // DHT 11
#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

// Initialize DHT sensor.
// Note that older versions of this library took an optional third parameter to
// tweak the timings for faster processors.  This parameter is no longer needed
// as the current DHT reading algorithm adjusts itself to work on faster procs.

void setup() {
 Serial.println("DHTxx test!");
 pinMode(led, OUTPUT); 

void loop() {
 // Reading temperature or humidity takes about 250 milliseconds!
 // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
 float h = dht.readHumidity();
 float t = dht.readTemperature();

 if (wetbulb <= critical) {
 digitalWrite (led, HIGH);   //wetbulb below critical trips led

 // check if returns are valid, if they are NaN (not a number) then something went wrong!
 if (isnan(t) || isnan(h)) {
   Serial.println("Failed to read from DHT");
 } else {
   Serial.print("Humidity: "); 
   Serial.print(" %\t");
   Serial.print("Temperature: "); 
   Serial.println(" *C");

Do you want h to the 3/2 power? This isn't going to do that. This is h XOR 0.


In the same convoluted line, here is the pow function with only one argument. Follow your parenthesis. It might be good to do that whole calculation in stages so you don’t get yourself all confused.

Delta_G: (h^(3/2)

Do you want h to the 3/2 power? This isn't going to do that. This is h XOR 0.

h XOR 1 actually

Oh, yes. My bad. 3/2 is 1.

sorry but i am still confused, can someone please change the equation accordingly

these errors have also shown.

DHT22_Tester22:40: error: expected primary-expression before '.' token DHT22_Tester22:40: error: expected unqualified-id before '(' token DHT22_Tester22:40: error: invalid operands of types 'float' and 'int' to binary 'operator^' DHT22_Tester22:42: error: expected ';' before 'if' DHT22_Tester22:63: error: expected '}' at end of input too few arguments to function 'double pow(double, double)'

sorry but i am still confused, can someone please change the equation accordingly

Where did you get that equation? Can you explain what it, and the individual terms in it are supposed to be doing?

Hint: it has already been pointed out that this bit has MANY errors and won't work.


Wow, just wow. What is this trying to do? Oh - trying to get the wet-bulb temperature given temp and humidity. Chill factor, basically.

  • No semicolon, for a start.

  • pow raises a number to a power. pow(5,2) gives you 25. If you just want to raise e to a power, use exp().

  • But that's not what you meant. This atan(.151977*pow(h+8.313659),0.5) is an obvious typo. You meant atan(.151977*pow(h+8.313659,0.5)). But rather than raising something to the .5 power, use sqrt(). It will have optimisations.

  • h^(3/2) won't work. In C, the hat operator does not do exponentation. You use pow() to do that. And 3/2, being an integer division, will compile down to 1. You want pow(h, 1.5), or better still h*sqrt(h).

  • define your magic numbers (8.313659, etc) as constants with meaningful names.

const double FUN_FACTOR = 1.676331
  • This: .(391838 is an obvious typo. You meant (.391838

  • where the hell is my cigarette lighter? Oh - never mind: there it is.

  • atan() has tricky boundary conditions, and its expensive. Id be surprised if this mess can't be simplified. I doubt you write it yourself, or else it wouldnt have so many typos.

  • I wonder if all those magic numbers would go away if you measured temperature in Celsius, or Kelvin? A one-off conversion to a better unit might make this mess far cleaner.

  • I would be inclined to something like this as an interpolation.

This post is a fine example of what Nick calls the "XY" problem. The OP does not need this line of code fixed until it compiles. What he actually needs is code that will correctly calculate wetbulb temperature given certain inputs. I'd be surprised if that formula is anywhere close to being right.