Advertisement
pleasedontcode

Serial Hello rev_08

Jun 4th, 2025
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: Serial Hello
  13.     - Source Code NOT compiled for: Arduino Pro Mini 3.3V
  14.     - Source Code created on: 2025-06-04 17:51:24
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* print hello */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /* START CODE */
  24.  
  25. /****** DEFINITION OF LIBRARIES *****/
  26. // Since Print.h is an abstract class, define a simple implementation for demonstration.
  27. class SerialPrint : public Print {
  28. public:
  29.     size_t write(uint8_t byte) override {
  30.         Serial.write(byte);
  31.         return 1;
  32.     }
  33. };
  34.  
  35. /****** FUNCTION PROTOTYPES *****/
  36. void setup(void);
  37. void loop(void);
  38.  
  39. // Instantiate the Print object
  40. SerialPrint myPrint;
  41.  
  42. void setup(void)
  43. {
  44.     // Initialize Serial communication at 9600 baud
  45.     Serial.begin(9600);
  46.     // Wait for serial port to connect. Needed for native USB port only
  47.     while (!Serial) {
  48.         ; // wait for serial port to connect.
  49.     }
  50.     // Print "hello" to serial monitor
  51.     myPrint.write('h');
  52.     myPrint.write('e');
  53.     myPrint.write('l');
  54.     myPrint.write('l');
  55.     myPrint.write('o');
  56.     myPrint.write('\n');
  57. }
  58.  
  59. void loop(void)
  60. {
  61.     // put your main code here, to run repeatedly:
  62.  
  63. }
  64.  
  65. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement