Ryan here from the MIT-i video series! I am having some trouble with programming (I think) and was hoping I could find some help in here like I have in the past. For this months video we are using the Sensirion STS3X Temperature Sensor (datasheet). We have surface mounted the IC to a breakout board, ran a successful continuity test, and wired the circuit according to the sensors datasheet, with ADDR tied to ground. We will be using Single Shot mode.
My current issue is that I am unable to receive information from the sensor and, not being a programmer, believe I am doing something wrong. I have attempted to follow the directions on the datasheet but never receive bytes in return from the sensor. Following the serial monitor, the loop makes it down to the "Serial.println("receiving");" line but never properly prints the returning bytes in the Wire.read(); command.
The code can be found below. Thanks in advance for the help!
Ryan
***************************************************************
Mod edit: moved to Embedded Systems. Added code tags
My current issue is that I am unable to receive information from the sensor and, not being a programmer, believe I am doing something wrong. I have attempted to follow the directions on the datasheet but never receive bytes in return from the sensor. Following the serial monitor, the loop makes it down to the "Serial.println("receiving");" line but never properly prints the returning bytes in the Wire.read(); command.
The code can be found below. Thanks in advance for the help!
Ryan
***************************************************************
C:
#include <Wire.h>
#define DEV_ID 0x4A >> 1 // shift required by wire.h
void setup()
{
Serial.begin(9600);
Wire.begin();
}
void loop()
{
Wire.beginTransmission(DEV_ID); // connect to Dev
Wire.write(0);
Wire.endTransmission();
Wire.write(0x2C); //request proper bits
Wire.write(0x06);
Wire.endTransmission();
Serial.println("write");
delay(1000); // give time for measurement
Serial.println("delay");
Wire.beginTransmission(DEV_ID);
Wire.requestFrom(DEV_ID, 2); // request two bytes
Serial.println("receiving");
while (Wire.available()) {
char c = Wire.read();
Serial.println(c);
}
delay (500);
}
Last edited by a moderator: