![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Compass Working
Temperature.cpp
- Committer:
- pstephens18
- Date:
- 2016-01-13
- Revision:
- 1:ef74b3428716
- Child:
- 3:e8bddc5aadc6
File content as of revision 1:ef74b3428716:
#include "Temperature.h" I2C tempsensor(p9,p10); const int addr = 0x90; char config_t[3]; char temp_read[2]; float temp; float Temperature() { config_t[0] = 0x01; config_t[1] = 0x60; config_t[2] = 0xA0; tempsensor.write(addr,config_t,3); config_t[0] =0x00; tempsensor.write(addr,config_t,1); wait(.5); tempsensor.read(addr, temp_read,2); temp= 0.0625*(((temp_read[0] << 8) + temp_read[1]) >> 4); return temp; }