not able to get seriaEvent working
Posted: Fri Mar 13, 2020 7:27 am
i have been trying to get the serialEvent() call working with no success
i have read this closed issue https://github.com/stm32duino/Arduino_C ... issues/584
and tried to follow exactly but am having trouble
i am sending data through serial3 ports and am trying to listen to it with serialEvent
i am not getting anything.
i know its not a wiring issue because the Serial.available code which is commented works just fine
but when i try to use serial event, nothing works
can anyone help?
here is my build_opt.h code
and here is my main code
i have read this closed issue https://github.com/stm32duino/Arduino_C ... issues/584
and tried to follow exactly but am having trouble
i am sending data through serial3 ports and am trying to listen to it with serialEvent
i am not getting anything.
i know its not a wiring issue because the Serial.available code which is commented works just fine
but when i try to use serial event, nothing works
can anyone help?
here is my build_opt.h code
Code: Select all
-DENABLE_HWSERIAL3
Code: Select all
bool toggle = true;
pinNumber_T pin1 = PA2;
void serialEvent3()
{
Serial.write(Serial3.read());
Serial.println("++++++++++++++++++++++++++++++++++++++++");
if(toggle)
digitalWrite(pin1, HIGH);
else
digitalWrite(pin1, LOW);
toggle = !toggle;
}
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial3.begin(115200);
pinMode(pin1, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
// if(Serial3.available())
// {
// digitalWrite(pin1,HIGH);
// Serial.println(char(Serial3.read()));
// delay(200);
// digitalWrite(pin1,LOW);
// Serial.println(char(Serial3.read()));
// delay(200);
// }
Serial.println("not getting data");
//delay(200);
}