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: "Bluetooth Detection"
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2023-12-08 06:46:17
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* scan for low energy bluetooth peripherals */
- /****** SYSTEM REQUIREMENT 2 *****/
- /* scan for bluetooth periphrals and if 1 is detected */
- /* then send 9 volts to pin 13 */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- #include <SoftwareSerial.h>
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF Software Serial *****/
- const uint8_t BLE_HC05_mySerial_PIN_SERIAL_TX_A0 = A0;
- const uint8_t BLE_HC05_mySerial_PIN_SERIAL_RX_A1 = A1;
- const uint8_t BLE_HC05_mySerial_PIN_SERIAL_TX_A2 = A2;
- const uint8_t BLE_HC05_mySerial_PIN_SERIAL_RX_A3 = A3;
- const uint8_t BLE_HC05_mySerial_PIN_SERIAL_TX_A4 = A4;
- const uint8_t BLE_HC05_mySerial_PIN_SERIAL_RX_A5 = A5;
- SoftwareSerial BLE_HC05_mySerial1(BLE_HC05_mySerial_PIN_SERIAL_RX_A1, BLE_HC05_mySerial_PIN_SERIAL_TX_A0);
- SoftwareSerial BLE_HC05_mySerial2(BLE_HC05_mySerial_PIN_SERIAL_RX_A3, BLE_HC05_mySerial_PIN_SERIAL_TX_A2);
- SoftwareSerial BLE_HC05_mySerial3(BLE_HC05_mySerial_PIN_SERIAL_RX_A5, BLE_HC05_mySerial_PIN_SERIAL_TX_A4);
- void setup(void)
- {
- // put your setup code here, to run once:
- BLE_HC05_mySerial1.begin(9600);
- BLE_HC05_mySerial2.begin(9600);
- BLE_HC05_mySerial3.begin(9600);
- pinMode(13, OUTPUT); // Pin 13 as output for sending 9 volts
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- /****** SYSTEM REQUIREMENT 1 *****/
- /* scan for low energy bluetooth peripherals */
- // Add your code to scan for low energy bluetooth peripherals here
- /****** SYSTEM REQUIREMENT 2 *****/
- /* scan for bluetooth peripherals and if 1 is detected */
- /* then send 9 volts to pin 13 */
- // Add your code to scan for bluetooth peripherals here
- // If 1 is detected, set pin 13 to HIGH
- // Otherwise, set pin 13 to LOW
- // Example code to set pin 13 to HIGH if 1 is detected
- if (1 /* is detected */) {
- digitalWrite(13, HIGH);
- } else {
- digitalWrite(13, LOW);
- }
- delay(1000); // Delay for 1 second
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement