experix wrote:I made example programs that operate the LED matrix; get joystick input; and monitor temperature reported by the pressure sensor, temperature/humidity sensor, accelerometer and CPU. Find it in
https://experix.sourceforge.net. Click
Dowload source files and information, select
sense-hat, download the archive and follow directions in the README (which is displayed under the file list). This is as 'basic' as you can get, not using RTIMULib; I'm trying to start with fundamentals and go up from there.
Thanks for the example code. I understood from the code that temperature.c shows the temperatures provided from the pressure sensor and temperature/humidity sensor but how can I obtain the pressure (in mbars) and humidity (as a percentage)?
Would this code work?
Code: Select all
// get a LPS25H pressure sample
res = ioctl( i2c, I2C_SLAVE, LPS25H_SAD );
buf[0] = LPS25H_STATUS_REG;
res = write( i2c, buf, 1 );
res = read( i2c, buf, 2 );
LPS25H_status = buf[0];
buf[0] = LPS25H_FIFO_STATUS;
res = write( i2c, buf, 1 );
res = read( i2c, buf, 2 );
LPS25H_fifo_status = buf[0];
buf[0] = LPS25H_PRESS_POUT | LPS25H_reg_auto;
res = write( i2c, buf, 1 );
res = read( i2c, buf, 2 );
LPS25Hd16[ii] = ((__s16 *)buf)[0];