Advertisement
pleasedontcode

"Task Manager" rev_01

Dec 14th, 2024
50
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: "Task Manager"
  13.     - Source Code NOT compiled for: Arduino Uno
  14.     - Source Code created on: 2024-12-15 05:12:54
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* task_manager = Taskmanager("1")   print("Hello! */
  21.     /* Welcome to our Task Management.")  option=  ”null” */
  22.     /* while option == null:      print(“\n1. Add Task”) */
  23.     /* print(“2. Complete Task”)      print(“3. Show */
  24.     /* Tasks”)      print(“4. End the Program”) */
  25. /****** END SYSTEM REQUIREMENTS *****/
  26.  
  27. /* START CODE */
  28.  
  29. /****** DEFINITION OF LIBRARIES *****/
  30. #include <Taskmanager.h> // Include the Taskmanager library
  31.  
  32. /****** FUNCTION PROTOTYPES *****/
  33. void setup(void);
  34. void loop(void);
  35.  
  36. // Instantiate the Taskmanager object
  37. arduino::task::Manager task_manager;
  38.  
  39. void setup(void)
  40. {
  41.     // Initialize the serial communication
  42.     Serial.begin(9600);
  43.    
  44.     // Print welcome message
  45.     Serial.println("Hello! Welcome to our Task Management.");
  46.    
  47.     String option = "null"; // Initialize option variable
  48.  
  49.     // Main loop for task management options
  50.     while (option == "null") {
  51.         Serial.println("\n1. Add Task");
  52.         Serial.println("2. Complete Task");
  53.         Serial.println("3. Show Tasks");
  54.         Serial.println("4. End the Program");
  55.        
  56.         // Wait for user input
  57.         while (Serial.available() == 0) {} // Wait for input
  58.         option = Serial.readStringUntil('\n'); // Read input until newline
  59.  
  60.         // Handle user options
  61.         if (option == "1") {
  62.             // Code to add a task
  63.             Serial.println("Task added.");
  64.         } else if (option == "2") {
  65.             // Code to complete a task
  66.             Serial.println("Task completed.");
  67.         } else if (option == "3") {
  68.             // Code to show tasks
  69.             Serial.println("Showing tasks.");
  70.         } else if (option == "4") {
  71.             Serial.println("Ending the program.");
  72.             option = "exit"; // Change option to exit the loop
  73.         } else {
  74.             Serial.println("Invalid option, please try again.");
  75.             option = "null"; // Reset option to null for retry
  76.         }
  77.     }
  78. }
  79.  
  80. void loop(void)
  81. {
  82.     // Update the task manager
  83.     task_manager.update();
  84. }
  85.  
  86. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement