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: Button Display
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2023-12-09 14:24:34
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* At the transmitter arduino side nrf24l01 module */
- /* with DS18B20 waterproof transmitter should send */
- /* data to the Receiver side with lcd display */
- /* Receiver should receive and display it on LCD */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- #include <EasyButton.h>
- #include <Wire.h>
- #include <LiquidCrystal_I2C.h>
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t NRF24_MODULE_PUSHBUTTON_PIN_D2 = 2;
- const uint8_t NRF24_MODULE_PUSHBUTTON_PIN_D3 = 3;
- const uint8_t NRF24_MODULE_PUSHBUTTON_PIN_D4 = 4;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- EasyButton buttonD2(NRF24_MODULE_PUSHBUTTON_PIN_D2);
- EasyButton buttonD3(NRF24_MODULE_PUSHBUTTON_PIN_D3);
- EasyButton buttonD4(NRF24_MODULE_PUSHBUTTON_PIN_D4);
- LiquidCrystal_I2C lcd(0x27, 16, 2); // Initialize the LCD object with I2C address 0x27, 16 columns and 2 rows
- void setup(void)
- {
- // put your setup code here, to run once:
- lcd.begin(16, 2); // Initialize the LCD
- lcd.print("Receiver Setup"); // Display a message on the LCD
- pinMode(NRF24_MODULE_PUSHBUTTON_PIN_D2, INPUT_PULLUP);
- pinMode(NRF24_MODULE_PUSHBUTTON_PIN_D3, INPUT_PULLUP);
- pinMode(NRF24_MODULE_PUSHBUTTON_PIN_D4, INPUT_PULLUP);
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- // Button D2
- buttonD2.read();
- if (buttonD2.wasPressed()) {
- lcd.clear();
- lcd.setCursor(0, 0);
- lcd.print("Button D2 Pressed"); // Display a message on the LCD when button D2 is pressed
- }
- // Button D3
- buttonD3.read();
- if (buttonD3.wasPressed()) {
- lcd.clear();
- lcd.setCursor(0, 0);
- lcd.print("Button D3 Pressed"); // Display a message on the LCD when button D3 is pressed
- }
- // Button D4
- buttonD4.read();
- if (buttonD4.wasPressed()) {
- lcd.clear();
- lcd.setCursor(0, 0);
- lcd.print("Button D4 Pressed"); // Display a message on the LCD when button D4 is pressed
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement