Advertisement
pleasedontcode

COT1 rev_02

Oct 22nd, 2023
88
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: COT1
  13.     - Source Code compiled for: Arduino Uno
  14.     - Source Code created on: 2023-10-22 12:05:12
  15.     - Source Code generated by: Shadrack
  16.  
  17. ********* Pleasedontcode.com **********/
  18. /****** DEFINITION OF LIBRARIES *****/
  19. #include <Arduino.h>
  20. #include <Wire.h>
  21. #include <Adafruit_SSD1306.h>
  22.  
  23. /****** SYSTEM REQUIREMENT 1 *****/
  24. /* Show numbers from 1 up to 10 endlessly */
  25.  
  26. /****** FUNCTION PROTOTYPES *****/
  27. void setup(void);
  28. void loop(void);
  29.  
  30. /***** DEFINITION OF I2C PINS *****/
  31. const uint8_t OLED_SSD1306OledDisplay_I2C_PIN_SDA_A4 = A4;
  32. const uint8_t OLED_SSD1306OledDisplay_I2C_PIN_SCL_A5 = A5;
  33. const uint8_t OLED_SSD1306OledDisplay_I2C_SLAVE_ADDRESS = 60;
  34.  
  35. Adafruit_SSD1306 display(OLED_SSD1306OledDisplay_I2C_SLAVE_ADDRESS);
  36.  
  37. void setup(void)
  38. {
  39.     // Initialize the OLED display
  40.     display.begin(SSD1306_SWITCHCAPVCC, OLED_SSD1306OledDisplay_I2C_PIN_SDA_A4, OLED_SSD1306OledDisplay_I2C_PIN_SCL_A5);
  41.     display.clearDisplay();
  42.     display.setTextColor(WHITE);
  43.     display.setTextSize(2);
  44.     display.setCursor(0, 0);
  45. }
  46.  
  47. void loop(void)
  48. {
  49.     // Show numbers from 1 to 10 endlessly
  50.     for (int i = 1; i <= 10; i++) {
  51.         display.clearDisplay();
  52.         display.println(i);
  53.         display.display();
  54.         delay(1000);
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement