necrolancer
New member
Hello! This is my first time using a Teensy product and have previously worked with Arduino.
I'm having trouble using the teensy to read a simple temperature reading from this temperature sensor.
http://www.mouser.com/ds/2/302/PCT2075-1127732.pdf
I was able to get it working on an Arduino Uno with the exact came code setup. Is there anything wrong with my code for my Teensy 3.6???
I am using 4.7k pullup resistors and am connected to pin 18 & 19 for SDA & SCL.
Output for Arduino: 68 (for Fahrenheit)
Output for Teensy 3.6: 0
ARDUINO CODE
TEENSY 3.6 CODE:
I'm having trouble using the teensy to read a simple temperature reading from this temperature sensor.
http://www.mouser.com/ds/2/302/PCT2075-1127732.pdf
I was able to get it working on an Arduino Uno with the exact came code setup. Is there anything wrong with my code for my Teensy 3.6???
I am using 4.7k pullup resistors and am connected to pin 18 & 19 for SDA & SCL.
Output for Arduino: 68 (for Fahrenheit)
Output for Teensy 3.6: 0
ARDUINO CODE
Code:
#include <Wire.h>
int address1 = 72;
void setup()
{
Serial.begin(9600);
Wire.begin();
Serial.println("Begin!");
}
void loop()
{
int c, Fahrenheit;
Wire.beginTransmission(address1);
Wire.write(0);
Wire.endTransmission();
Wire.requestFrom(address1, 2);
c = Wire.read();
Fahrenheit = (1.8)*c + 32;
Serial.print("Temperature: ");
Serial.println(Fahrenheit);
delay(1000);
}
TEENSY 3.6 CODE:
Code:
#include <Wire.h>
int address1 = 72;
int pin_SDA = 18;
int pin_SCL = 19;
void setup()
{
Serial.begin(9600);
Wire.begin();
Wire.setSDA(pin_SDA);
Wire.setSCL(pin_SCL);
delay(1000);
Serial.println("Begin!");
}
void loop()
{
int c;
Wire.beginTransmission(address1);
Wire.write(0);
Wire.endTransmission();
Wire.requestFrom(address1, 2);
c = Wire.receive();
Serial.print("Temperature: ");
Serial.println(c);
delay(1000);
}