
Originally Posted by
el_supremo
The Teensy 3 is a 3.3V device. Connecting 5V (e.g. TTL) to it could destroy the chip.
I hope to have been careful enough (e.g. by using a level converter), and I just tested again with a board that I did not use until now with the same result, so I don't exactly know what is happening.
Paul, thanks for your answer, I did adapt the library to use one of the Serial port of the board. To simplify, here is a self contained example of code that I tried (which block on the "reading command part" when executed):
Code:
uint8_t command[4] = { 0x22, 0x00, 0x00, 0x22 };
char response[4];
void setup() {
Serial.begin(9600);
Serial.println("Starting");
Serial.flush();
Serial1.begin(9600);
delay(1000);
}
void loop() {
Serial.println("Sending command...");
Serial.flush();
Serial1.write(command, 4);
Serial1.flush();
Serial.println("Reading result:");
Serial.flush();
for (int i = 0; i < 4; i++) {
while (!Serial1.available()) { };
Serial.print(Serial1.read());
Serial.print(" ");
}
Serial.println("");
Serial.flush();
delay(1000);
}
My hope was that someone would have the same sensor (or a similar one) and could tell me if they manage (and how) to interface it with the teensy.
for the I2C I used pullup resistors as per the information on the Wire library page, so here also if someone have a similar component I would be interested to know how they managed to use it.
Thanks!