/********************************************************
*  Code to access the raw data coming from teh I2C thermo
*  pile array and dispay it on the console.
*  By: Jonathan Mash
*  Date: Feb. 2009
*********************************************************/
 
#include <Wire.h>
byte sensor_address = 0xd0;
 
void setup()
{
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output
  Serial.print("Starting TPA81 bus\n");
}
 
void loop()
{
  byte b, s;
  int i;
  for (i=0; i<=9; i++)
  {
    Wire.beginTransmission(sensor_address>>1);
    Wire.send(i);
    Wire.endTransmission();
 
    Wire.requestFrom(sensor_address>>1, (int) 1);
 
    while(Wire.available() < 1)
    { ; }
 
    b = Wire.receive(); // receive a byte as character
 
    Serial.print(b, DEC);
    Serial.print(" ");
 
    delay(10);
  }
  Serial.println("");
 
  delay(500);
}
tpa81read.txt · Last modified: 2009/03/04 05:35 by jonmash
Back to top
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0