Advertisement
pleasedontcode

"Potentiometer Display" rev_42

Oct 1st, 2024
71
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: "Potentiometer Display"
  13.     - Source Code NOT compiled for: Arduino Pro Mini 3.3V
  14.     - Source Code created on: 2024-10-01 20:39:01
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* read and provide pot value via wifi */
  21. /****** SYSTEM REQUIREMENT 2 *****/
  22.     /* if main code is too long so split code in other */
  23.     /* files. */
  24. /****** END SYSTEM REQUIREMENTS *****/
  25.  
  26. /****** DEFINITION OF LIBRARIES *****/
  27. #include <WiFiPicker.h>  // https://github.com/Tvde1/WiFiPicker
  28. #include "PotentiometerReader.h" // Include the PotentiometerReader header
  29.  
  30. /****** FUNCTION PROTOTYPES *****/
  31. void setup(void);
  32. void loop(void);
  33.  
  34. /***** DEFINITION OF ANALOG INPUT PINS *****/
  35. const uint8_t pot_Potentiometer_Vout_PIN_A0 = A0;
  36.  
  37. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  38. // Initialize the WiFiPicker object
  39. WiFiPicker wifiPicker; // Create an instance of WiFiPicker
  40. PotentiometerReader potReader(pot_Potentiometer_Vout_PIN_A0); // Create an instance of PotentiometerReader
  41.  
  42. void setup(void)
  43. {
  44.     // Start the WiFiPicker service
  45.     wifiPicker.start(); // Call the start method of WiFiPicker
  46.     Serial.begin(115200); // Start serial communication for debugging
  47. }
  48.  
  49. void loop(void)
  50. {
  51.     // Read the potentiometer value
  52.     int potValue = potReader.readValue(); // Get the potentiometer value
  53.  
  54.     // Print the potentiometer value to the Serial Monitor
  55.     Serial.print("Potentiometer Value: ");
  56.     Serial.println(potValue);
  57.  
  58.     delay(1000); // Delay for a second before the next reading
  59. }
  60.  
  61. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement