Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I've been working on a little project on an Arduino and I need some help with making the code more efficient / cleaner. I really don't like the three for loops. I and feel like I could condense them somehow.
###Code:
I've been working on a little project on an Arduino and I need some help with making the code more efficient / cleaner. I really don't like the three for loops. I feel like I could condense them somehow.
###Code:
I've been working on a little project on an Arduino and I need some help with making the code more efficient / cleaner. I really don't like the three for loops and feel like I could condense them somehow.
AAn HC-05 Bluetooth module is connected via a serial connection to an Arduino Micro.
The Arduino filters the serial data and extracts the MAC addresses that it finds.
The discovered MAC addresses are compared against a whitelistwhite-list.
Once a whitelistedwhite-listed device comes in range of the Bluetooth module AND passes a light barrier, the door opens.
The door can only be re-opened if either a NEW device comes in range, or if the already entered device has left the Bluetooth range for at least 10 seconds and re-enters.
###Code:
Bluetooth door-opener program
A HC-05 Bluetooth module is connected via a serial connection to an Arduino Micro.
The Arduino filters the serial data and extracts the MAC addresses that it finds.
The discovered MAC addresses are compared against a whitelist.
Once a whitelisted device comes in range of the Bluetooth module AND passes a light barrier, the door opens.
The door can only be re-opened if either a NEW device comes in range, or if the already entered device has left the Bluetooth range for at least 10 seconds and re-enters.
Door-opener program
An HC-05 Bluetooth module is connected via a serial connection to an Arduino Micro.
The Arduino filters the serial data and extracts the MAC addresses that it finds.
The discovered MAC addresses are compared against a white-list.
Once a white-listed device comes in range of the Bluetooth module AND passes a light barrier, the door opens.
The door can only be re-opened if either a NEW device comes in range, or if the already entered device has left the Bluetooth range for at least 10 seconds and re-enters.