hi all im trying to program a sht71 sensor but still not working i have a code but nothing happens... this the code
/ Maurice Ribble
// 4-3-2008
// http://www.glacialwanderer.com/hobbyrobotics
// This code tests the SHT15 on the Arduino board.
// This app assumes your data pin is pin 10 and your your clock pin is pin 11.
// To run this app just attach HyperTerminal (or similar serial communications tool)
// to your Arduino board at 9600 bits per second. I also needed te set the
// flow control to none or I couldn't send commands to my Arduino board via HyperTerminal.
// Then press the 't' key to take a temperature reading or the 'h' key to take a
// humidity reading.
// These are commands we need to send to HSHT15 to control it
int gTempCmd = 0b00000011;
int gHumidCmd = 0b00000101;
int shiftIn(int dataPin, int clockPin, int numBits)
{
int ret = 0;
int i;
for (i=0; i 0)
{
cmd = Serial.read();
switch (cmd)
{
case 't': //Read Temperature
{
int val;
int temp;
sendCommandSHT(gTempCmd, theDataPin, theClockPin);
waitForResultSHT(theDataPin);
val = getData16SHT(theDataPin, theClockPin);
skipCrcSHT(theDataPin, theClockPin);
Serial.print("Temp is:");
Serial.print(val, HEX);
temp = -40.0 + 0.018 * (float)val;
Serial.print(" ");
Serial.println(temp, DEC);
break;
}
case 'h': //Read Humidity
{
int val;
int humid;
sendCommandSHT(gHumidCmd, theDataPin, theClockPin);
waitForResultSHT(theDataPin);
val = getData16SHT(theDataPin, theClockPin);
skipCrcSHT(theDataPin, theClockPin);
Serial.print("Humidity is:");
Serial.print(val, HEX);
humid = -4.0 + 0.0405 * val + -0.0000028 * val * val;
Serial.print(" ");
Serial.println(humid, DEC);
break;
}
default:
{
Serial.println("You pressed something else");
}
}
}
}
any idea??? need help and also lib doesnt work