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 Sensor
- - Source Code NOT compiled for: Arduino Pro Mini 3.3V
- - Source Code created on: 2024-09-26 04:46:18
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* Aimbot in gpc Cronus zen */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <EasyButton.h> //https://github.com/evert-arias/EasyButton
- #include <AS3935-Lightning-sensor-SOLDERED.h> //https://github.com/SolderedElectronics/Soldered-AS3935-Lightning-detect-Arduino-Library
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF DIGITAL INPUT PINS *****/
- const uint8_t Ff_PushButton_PIN_D2 = 2;
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- // Initialize the EasyButton object with the pin number and default parameters
- EasyButton button(Ff_PushButton_PIN_D2);
- // Initialize the AS3935 lightning sensor object with the default I2C address
- AS3935 lightningSensor(0x03); // Using the constructor with the address
- /****** FUNCTION DEFINITIONS *****/
- void setup(void)
- {
- // Start serial communication for debugging
- Serial.begin(115200);
- // Set the button pin as input with internal pull-up resistor
- pinMode(Ff_PushButton_PIN_D2, INPUT_PULLUP);
- // Initialize the EasyButton
- button.begin();
- // Set up a callback function for button press events
- button.onPressed([]() {
- Serial.println("Button has been pressed");
- });
- // Initialize the lightning sensor
- if (!lightningSensor.begin()) { // Check if the sensor initializes correctly
- Serial.println("Lightning Detector did not start up, freezing!");
- while (1); // Loop forever if initialization fails
- } else {
- Serial.println("Lightning Detector initialized successfully!");
- }
- }
- void loop(void)
- {
- // Read the button state
- button.read();
- // Add additional code to handle lightning detection if needed
- // Example: if (lightningSensor.detectLightning()) { ... }
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement