31
Project logs / Re: TMP006 BOB free build
I will take a look, hopefully I will be able to measure running zombies : )
Have seen a couple lately!!
Open Source Hardware
This section allows you to view all Messages made by this member. Note that you can only see Messages made in areas you currently have access to.
#include "Wire.h"
#define tmp066address 0x40 //wire library uses 7bit adrresses, 8bit address is 0x80
void setup(){
Wire.begin();
delay(1000);
Serial.begin(9600);
}
void getTMP006data(byte *a, byte *b){
Wire.beginTransmission(tmp066address);
Wire.write((uint8_t) 0x01); // tmp register
Wire.endTransmission();
Wire.requestFrom(tmp066address, 2); //request two bytes
*a=Wire.read();
*b=Wire.read();
}
void showTMP006data(){
byte aa,bb;
float temperature=0;
int tmp;
getTMP006data(&aa,&bb);
if (aa>127) // check for below zero degrees
{
tmp = aa << 8;
tmp += bb; //concatenate aa and bb
tmp = tmp >> 2; //shift 2 bits to the right
tmp = ~tmp; //invert bits
tmp +=1; // add 1
temperature = (float)tmp / 32; //transform to physical temp in Celcius
temperature = -temperature; //change sign
} else // it must be above zero degrees
{
tmp = aa << 8;
tmp += bb; //concatenate aa and bb
tmp = tmp >> 2; //shift 2 bits to the right
temperature = (float)tmp / 32; //transform to physical temp in Celcius
}
Serial.print("Temperature = ");
Serial.print(temperature,2); //print with two decimals
Serial.println(" degrees C");
delay(500);
}
void loop(){
showTMP006data();
}
B1:blinky fco$ make flashWhy does it try to open a telnet connection?
arm-none-eabi-objcopy -Obinary blinky.elf blinky.bin
./do_flash.pl blinky.bin
problem connecting to "127.0.0.1", port 4444: Connection refused at ./do_flash.pl line 20
make: *** [flash] Error 61