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 Counter
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2023-12-10 05:01:53
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* compare the number of ble peripherals with rssi */
- /* value above -40 with buetooth peripherals below */
- /* -40. do not detect blutooth peripherals with rssi */
- /* value above -60 */
- /****** SYSTEM REQUIREMENT 2 *****/
- /* compare the number of ble peripherals with rssi */
- /* value above -40 with buetooth peripherals below */
- /* -40. if a is more send 9 volts to pin 13. if b is */
- /* more 9 volts to pin 11 .send do not detect */
- /* blutooth peripherals with rssi value above -60 */
- /****** 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 d_HC05_mySerial_PIN_SERIAL_TX_A0 = A0; // Define the pin for TX
- const uint8_t d_HC05_mySerial_PIN_SERIAL_RX_A1 = A1; // Define the pin for RX
- SoftwareSerial d_HC05_mySerial(d_HC05_mySerial_PIN_SERIAL_RX_A1, d_HC05_mySerial_PIN_SERIAL_TX_A0);
- void setup(void)
- {
- // put your setup code here, to run once:
- d_HC05_mySerial.begin(9600);
- pinMode(13, OUTPUT); // Set pin 13 as output
- pinMode(11, OUTPUT); // Set pin 11 as output
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- int bleCount = 0; // Counter for BLE peripherals
- int rssi = -50; // Sample RSSI value
- // Check if BLE peripherals have RSSI above -40
- if (rssi > -40) {
- bleCount++;
- }
- // Check if Bluetooth peripherals have RSSI below -40
- if (rssi < -40) {
- bleCount--;
- }
- // Compare the number of BLE peripherals with RSSI value above -40
- if (bleCount > 0) {
- digitalWrite(13, HIGH); // Send 9 volts to pin 13
- } else if (bleCount < 0) {
- digitalWrite(11, HIGH); // Send 9 volts to pin 11
- }
- delay(1000); // Delay for 1 second
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement