Skip to content

Default implementation of serialEventRun() is not called so serialEvent does not work #985

Closed
@jonghaboy

Description

@jonghaboy

hello i am having trouble implementing a serialEvent on a bluepill

the serialevent will not read the data being sent to it by an arduino can anyone help?

here is my code

#include "build_opt.h"


bool toggle = true;
pinNumber_T pin1 = PA2;
//HardwareSerial Serial3(PA10, PA9);

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);
}

and here is my build_opt.h

-DENABLE_HWSERIAL3
-PIN_SERIAL3_RX=PB11
-PIN_SERIAL3_TX=PB10

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions