Trouble connecting esp32 v1 dev board to UART Adapter V1
Posted: Mon Jan 24, 2022 1:31 pm
I tried making as simple of a sketch as I could out of the rpm example sketch as seen below. I connected the green wire to GPIO3 (rx) and the white wire to GPIO1 (tx). However, the blue light on the esp32 (pin 2) never came on. I've tried another sketch with mySerial(115200) to see where the code was hanging up at. It appeared as if it couldnt get past obd.init(), and attempted to initialize once every 1min 13sec. I do know that the esp32 is getting power from the freematics adapter. But maybe not a Serial connection? I was worried the serial connections between the freematics unit and the Serial monitor overlapped so I've been trying to get feedback with just the blue light, hence the code below. Could anyone help me figure out the problem here? I'm kinda a noob at the serial stuff, maybe I can verify the wires on the freematics unit are still working with a multimeter somehow?
Code: Select all
#include <OBD2UART.h>
COBD obd;
void setup()
{
// we'll use the debug LED as output
pinMode(2, OUTPUT);
// start communication with OBD-II UART adapter
obd.begin();
// initiate OBD-II connection until success
while (!obd.init());
}
void loop()
{
int value;
if (obd.readPID(PID_RPM, value)) {
// RPM is successfully read and its value stored in variable 'value'
// light on LED when RPM exceeds 1000
digitalWrite(2, value > 1000 ? HIGH : LOW);
}
}