Advertisement
pleasedontcode

"Card Setup" rev_01

Mar 31st, 2024
108
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: "Card Setup"
  13.     - Source Code compiled for: ESP32 DevKit V1
  14.     - Source Code created on: 2024-03-31 23:08:31
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* Configure WiFi and timezone settings with web page */
  21.     /* available via both AP and STA */
  22. /****** END SYSTEM REQUIREMENTS *****/
  23.  
  24. /****** DEFINITION OF LIBRARIES *****/
  25. #include <WiFi.h>
  26. #include <WebServer.h>
  27. #include <SD.h>
  28.  
  29. /****** FUNCTION PROTOTYPES *****/
  30. void setup(void);
  31. void loop(void);
  32.  
  33. /***** DEFINITION OF SPI PINS *****/
  34. #define SD_MOSI 23
  35. #define SD_MISO 19
  36. #define SD_SCLK 18
  37. #define SD_CS 5
  38.  
  39. /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
  40. File file;
  41.  
  42. void setup(void)
  43. {
  44.     // put your setup code here, to run once:
  45.  
  46.     pinMode(SD_CS, OUTPUT);
  47.     // start the SPI library:
  48.     SPI.begin(SD_SCLK, SD_MISO, SD_MOSI, SD_CS);
  49.  
  50.     // CODE FOR SYSTEM REQUIREMENT 1: Configure WiFi and timezone settings with web page
  51.     // available via both AP and STA
  52.     // ... Add your code here ...
  53.  
  54.     if (!SD.begin(SD_CS))
  55.     {
  56.         Serial.println("Initialization of SD card failed!");
  57.         return;
  58.     }
  59.  
  60.     // other optional initializations
  61.  
  62.     Serial.println("SD card initialized.");
  63. }
  64.  
  65.  
  66. void loop(void)
  67. {
  68.     // put your main code here, to run repeatedly:
  69.  
  70.     // ... Add your code here ...
  71. }
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement