I have a Particle Boron and Adafruit Huzzah32/ESP32 which are connected through Serial/UART:
Boron TX pin connected to Huzzah32/ESP32 RX pin
and
Boron RX pin connected to Huzzah32/ESP32 TX pin
I can’t find any example how to send a simple number lets say “123” from Boron to Huzzah32/32 and back. Just looking for simple working example, nothing complicated.
Welcome to the community.
What you are looking for is doable and it wouldn't matter whether you are talking to a ESP32 or another Particle device. As long as both sides don't exceed the voltage limit of the respectively other you can connect any micro with any other via UART.
Having said that, have you searched the forum before posting as this is a rather common question?
This would be a tip stated in this Forum Etiquette post.
I can’t get it to work, it’s my 3rd day of struggle, information is very misleading.
I noticed there is a difference between Arduino UNO/Mega/ESP32 the way code is written and read by boards.
I’m trying to make it as simple as possible.
ESP is a transmitter:
int A = 9;
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.write(A);
delay(1000);
}
Boron is a receiver
#include "Particle.h"
SYSTEM_MODE(SEMI_AUTOMATIC);
int B;
void setup()
{
Serial.begin(115200);
Serial1.begin(9600);
}
void loop()
{
if (Serial1.available())
{
B = Serial1.read();
Serial.print("Value is: " + String(B));
}
}
I’d have to look into the ESP32 jargon but I’d think that Serial also refers to the USB Serial interface there as it does on the Particle devices.
I thing with the Adafruit Huzzah32 it’s also Serial1.
A simple test would be to start with loop-back communication. Just connect RX and TX on the same board and read back the data you send out of the device itself.
Also how have you connected the two controlers?
Do you have common GND between the two?
Have you got TX->RX and vice versa?
BTW, since between iterations of loop() other things might be happening it’s better to use while(Serial1.available()) instead of if()