Timeline for which is the best way to declare Serial while creating Arduino library?
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 22, 2021 at 19:39 | comment | added | Juraj♦ | @mehmet, it is common C++ object member access you asked about | |
Aug 22, 2021 at 19:32 | comment | added | Michel Keijzers | @Juraj Thanks for that addition (I was not sure, so I removed the comment about not being sure and the statement in my answer). | |
Aug 22, 2021 at 19:32 | history | edited | Michel Keijzers | CC BY-SA 4.0 |
deleted 57 characters in body
|
Aug 22, 2021 at 13:16 | comment | added | JRobert |
If you have access to the object itself, e.g., Serial , you can say Serial.println() . If your library only has a pointer to the object, you have use -> , the dereference operator: serialPtr->println() . The result is the same: calling the object's 'println()' member. The difference is in how the compiled code gets you to that member.
|
|
Aug 22, 2021 at 12:32 | comment | added | mehmet | Can i ask a last question, why second method uses "->" and Why not "." Such us _serial.begin(baud). Is this totally same | |
Aug 22, 2021 at 11:21 | comment | added | Juraj♦ | there is no Serial base class | |
Aug 22, 2021 at 11:00 | history | answered | Michel Keijzers | CC BY-SA 4.0 |