pleasedontcode

System Setup rev_04

Jul 27th, 2025
134
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: System Setup
  13.     - Source Code compiled for: Arduino Opta WiFi
  14.     - Source Code created on: 2025-07-27 15:19:03
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* Implement a WiFi connection setup using the */
  21.     /* Arduino Opta WiFi module to enable wireless */
  22.     /* communication for the project. Use the onboard */
  23.     /* WiFi resources to connect to a specified network. */
  24. /****** END SYSTEM REQUIREMENTS *****/
  25.  
  26.  
  27. /* START CODE */
  28.  
  29. /****** DEFINITION OF LIBRARIES *****/
  30. #include <Adafruit_NeoPixel.h>  //https://github.com/adafruit/Adafruit_NeoPixel
  31. #include <EasyButton.h> //https://github.com/evert-arias/EasyButton
  32. #include <WiFi.h> // Include WiFi library for Arduino Opta WiFi module
  33.  
  34. /****** FUNCTION PROTOTYPES *****/
  35. void setup(void);
  36. void loop(void);
  37. void connectWiFi(void);
  38.  
  39. /***** DEFINITION OF DIGITAL INPUT PINS *****/
  40. const uint8_t button_PushButton_PIN_A0 = A0;
  41.  
  42. /***** DEFINITION OF DIGITAL OUTPUT PINS *****/
  43. const uint8_t myLED_RGB_LEDRGB_Red_PIN_D0 = 0;
  44. const uint8_t myLED_RGB_LEDRGB_Green_PIN_D1 = 1;
  45. const uint8_t myLED_RGB_LEDRGB_Blue_PIN_D2 = 2;
  46.  
  47. /***** DEFINITION OF OUTPUT RAW VARIABLES *****/
  48. /***** used to store raw data *****/
  49. bool myLED_RGB_LEDRGB_Red_PIN_D0_rawData = 0;
  50. bool myLED_RGB_LEDRGB_Green_PIN_D1_rawData = 0;
  51. bool myLED_RGB_LEDRGB_Blue_PIN_D2_rawData = 0;
  52.  
  53. /***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
  54. /***** used to store data after characteristic curve transformation *****/
  55. float myLED_RGB_LEDRGB_Red_PIN_D0_phyData = 0.0;
  56. float myLED_RGB_LEDRGB_Green_PIN_D1_phyData = 0.0;
  57. float myLED_RGB_LEDRGB_Blue_PIN_D2_phyData = 0.0;
  58.  
  59. /****** WiFi credentials *****/
  60. const char* ssid = "Your_SSID"; // Replace with your WiFi network SSID
  61. const char* password = "Your_PASSWORD"; // Replace with your WiFi password
  62.  
  63. /****** LIBRARY CLASS INSTANCES *****/
  64. // No specific instances needed for WiFi, using the WiFi library functions
  65.  
  66. void connectWiFi() {
  67.   Serial.println("Connecting to WiFi...");
  68.   WiFi.begin(ssid, password);
  69.   while (WiFi.status() != WL_CONNECTED) {
  70.     delay(500);
  71.     Serial.print(".");
  72.   }
  73.   Serial.println("");
  74.   Serial.println("WiFi connected");
  75.   Serial.print("IP address: ");
  76.   Serial.println(WiFi.localIP());
  77. }
  78.  
  79. void setup(void)
  80. {
  81.   // put your setup code here, to run once:
  82.  
  83.   Serial.begin(115200);
  84.   // Connect to WiFi
  85.   connectWiFi();
  86.  
  87.   pinMode(button_PushButton_PIN_A0, INPUT_PULLUP);
  88.  
  89.   pinMode(myLED_RGB_LEDRGB_Red_PIN_D0, OUTPUT);
  90.   pinMode(myLED_RGB_LEDRGB_Green_PIN_D1, OUTPUT);
  91.   pinMode(myLED_RGB_LEDRGB_Blue_PIN_D2, OUTPUT);
  92. }
  93.  
  94. void loop(void)
  95. {
  96.   // put your main code here, to run repeatedly:
  97.  
  98.   updateOutputs(); // Refresh output data
  99. }
  100.  
  101. void updateOutputs()
  102. {
  103.   digitalWrite(myLED_RGB_LEDRGB_Red_PIN_D0, myLED_RGB_LEDRGB_Red_PIN_D0_rawData);
  104.   digitalWrite(myLED_RGB_LEDRGB_Green_PIN_D1, myLED_RGB_LEDRGB_Green_PIN_D1_rawData);
  105.   digitalWrite(myLED_RGB_LEDRGB_Blue_PIN_D2, myLED_RGB_LEDRGB_Blue_PIN_D2_rawData);
  106. }
  107.  
  108. /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment