Hardware Serial

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
zzcrow
 
Posts: 54
Joined: Sun Jun 12, 2016 12:27 pm

Hardware Serial

Post by zzcrow »

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

User avatar
zzcrow
 
Posts: 54
Joined: Sun Jun 12, 2016 12:27 pm

Re: Hardware Serial

Post by zzcrow »

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!!!!

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”