Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: MyFirstProject
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2023-10-19 01:41:18
- - Source Code generated by: MeetArbaz
- ********* Pleasedontcode.com **********/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- #include <Wire.h>
- #include <Adafruit_SSD1306.h>
- /****** SYSTEM REQUIREMENT 1 *****/
- /* Make a form with two inputs: one for name and one for password, and add a submit button. */
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF I2C PINS *****/
- const uint8_t lcd_SSD1306OledDisplay_I2C_PIN_SDA_A4 = A4;
- const uint8_t lcd_SSD1306OledDisplay_I2C_PIN_SCL_A5 = A5;
- const uint8_t lcd_SSD1306OledDisplay_I2C_SLAVE_ADDRESS = 0x3C;
- // Define the form inputs and submit button
- const int nameInputX = 40;
- const int nameInputY = 0;
- const int nameInputWidth = 80;
- const int nameInputHeight = 10;
- const int passwordInputX = 40;
- const int passwordInputY = 15;
- const int passwordInputWidth = 80;
- const int passwordInputHeight = 10;
- const int submitButtonX = 40;
- const int submitButtonY = 30;
- const int submitButtonWidth = 40;
- const int submitButtonHeight = 10;
- // Variables to store the input values
- String nameInputValue = "";
- String passwordInputValue = "";
- Adafruit_SSD1306 display(128, 64, &Wire, -1);
- void setup(void)
- {
- // Put your setup code here, to run once:
- Wire.begin();
- // Initialize the SSD1306 display with the I2C address
- display.begin(SSD1306_SWITCHCAPVCC, lcd_SSD1306OledDisplay_I2C_SLAVE_ADDRESS);
- display.display();
- delay(2000);
- display.clearDisplay();
- }
- void loop(void)
- {
- // Put your main code here, to run repeatedly:
- // Display the form on the SSD1306 OLED display
- display.setTextSize(1);
- display.setTextColor(WHITE);
- // Draw the name input
- display.setCursor(nameInputX, nameInputY);
- display.println("Name:");
- display.drawRect(nameInputX, nameInputY + 10, nameInputWidth, nameInputHeight, WHITE);
- display.setCursor(nameInputX + 2, nameInputY + 12);
- display.println(nameInputValue);
- // Draw the password input
- display.setCursor(passwordInputX, passwordInputY);
- display.println("Password:");
- display.drawRect(passwordInputX, passwordInputY + 10, passwordInputWidth, passwordInputHeight, WHITE);
- display.setCursor(passwordInputX + 2, passwordInputY + 12);
- display.println(passwordInputValue);
- // Draw the submit button
- display.drawRect(submitButtonX, submitButtonY, submitButtonWidth, submitButtonHeight, WHITE);
- display.setCursor(submitButtonX + 2, submitButtonY + 2);
- display.println("Submit");
- display.display();
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement