0

Hardware Serial
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Hardware Serial

by zzcrow on Sun Sep 26, 2021 2:19 pm

I need to know how to create an object for hardware Serial on all boards please. Nodemcu, mega, grand central, feathers, etc. (This is for sensors that use rx and tx pins) Seems like how it is created has changed? The sensor expects an instantiated hardware serial object, which is passed to a function that configs the sensor . This is for a dfrobot gesture sensor. This migraine is not letting me think Lol

zzcrow
 
Posts: 38
Joined: Sun Jun 12, 2016 12:27 pm

Re: Hardware Serial

by zzcrow on Mon Sep 27, 2021 2:44 pm

Nevermind I figured it out :/ Answer: #include "HardwareSerial.h" Serial1 is first hardware serial, but on nodemcu I have to use Serial.swap() to use a sensor due to flash properties.
Depending on how many hardware Serials there are you keep going from Serial1 as first, Serial2, etc depending on how many there are. Doh!!!!

zzcrow
 
Posts: 38
Joined: Sun Jun 12, 2016 12:27 pm

Please be positive and constructive with your questions and comments.