Hi, I'm trying to simply connect an esp32 and a teensy3.5 over serial but can't for the life of me get it to work. I think the problem lies on the Teensy end as i have been able to connect the esp32 to other devices. Can anyone offer some guidance? Thanks.
Code:
/*
* Teensy 3.5 Serial2
* ON Board LED PIN 13
* Serial ESP32 > Teensy 3.5 Serial2
* TXD > RX2 pin 9
* RXD > TX2 pin 10
*/
int LED = 13;
int inByte =2 ;
void setup() {
pinMode(LED, OUTPUT);
Serial2.begin(9600);
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
}
void loop() {
//testSend();
testRecieve();
}
void testSend(){
delay(500);
Serial2.write(1); digitalWrite(LED,HIGH);
delay(500);
Serial2.write(0); digitalWrite(LED,LOW);
}
void testRecieve(){
if (Serial2.available() > 0) {
inByte = Serial2.read();
if(inByte == 1){ digitalWrite(LED, HIGH); }
if(inByte == 0){ digitalWrite(LED, LOW); }
}}
Code:
/*
* ESP32 Serial
* ON Board LED GPIO 2
* Serial ESP32 > Teensy 3.5
* TXD > RX2 pin 9
* RXD > TX2 pin 10
*/
#define LED 2
int inByte = 2 ;
void setup() {
Serial.begin(9600);
pinMode(LED,OUTPUT);
}
void loop() {
testSend();
// testRecieve();
}
void testSend(){
delay(500);
Serial.write(1); digitalWrite(LED,HIGH);
delay(500);
Serial.write(0); digitalWrite(LED,LOW);
}
void testRecieve(){
if (Serial.available() > 0) {
inByte = Serial.read();
if(inByte == 1){ digitalWrite(LED, HIGH);}
if(inByte == 0){ digitalWrite(LED, LOW); }
} }
Last edited: