'Example program to read CMPS03 func main() const sda 0 const scl 1 const CMPS03 $C0 ' I2C bus address const Ver_reg 0 ' CMPS03 register addresses const Bearing_reg 2 ' Bearing dim Ver, Bearing while(1=1) ' loop forever Ver = I2cin(sda,scl,CMPS03,Ver_reg) Bearing.byte(1) = I2cin(sda,scl,CMPS03,Bearing_reg) ' high byte Bearing.byte(0) = I2cin(sda,scl,CMPS03,Bearing_reg+1) ' low byte print "Version ", Ver, ", Bearing ",Bearing/10, " degrees" wend endfunc include \lib\DiosI2c.lib