Go Down

Topic: Issue getting data into database from DS1820 temperture sensors (Read 648 times) previous topic - next topic

tcpip389

Hi,
I am try to get my DS1820 temperature sensor addresses in to a mysql database.
I can get all the required field entries I require, temperature, but for the address I can only get the last 2 digits of the address into the database. :(

This is the function I have created. I am only using 2 temperature sensors.
addresses are  28DCBD4903000093 and  28B59A490300006F
I am wondering if this has to do with the webClient.print() and something else needs to be added like a char array??
the column in the database is set to Name: TempTag, Type: varchar(16), not null.
In the database column I get 93 or 6F
which is making me very confused...

/* Function */
void writeAddress( DeviceAddress deviceAddress )
{
  if( deviceAddress == insideThermometer )
  {
    Serial.println( "inside" );
    for( uint8_t i = 0; i < 8; i++ )
    {
      if( deviceAddress[ i ] < 16 )
      {
        Serial.println( "0" );
        webClient.print( "0" );
      }
      webClient.print( "&TempAddress0=" );
      webClient.print( deviceAddress[ i ], HEX );
    }
   
  }
  else if( deviceAddress == outsideThermometer )
  {
    Serial.println( "outside" );
    for(uint8_t j = 0; j < 8; j ++ )
    {
      if( deviceAddress[ j ] < 16 )
      {
        Serial.println( "0" );
        webClient.print( "0" );
      }
      webClient.print( "&TempAddress1=" );
      webClient.print( deviceAddress[ j ], HEX );
    }
   
  }
}

wildbill

I rather suspect that this:
Code: [Select]
webClient.print( "&TempAddress0=" );

should be before the for loop, not inside it.

robtillaart

Well spotted bill!

also true for - webClient.print( "&TempAddress1=" ); -
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

tcpip389

Thanks you so much I just tried it out now and I can see the entries in my database tables .... it works!!!!! :)
I9 really appreciate the help thanks

robtillaart

maybe you can post the whole code (arduino & mysql side) so people in the future can find it.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up