Skip to main content
added 3 characters in body
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237

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.

removed tag from title
Source Link
Malachi
  • 28.7k
  • 11
  • 86
  • 188

Bluetooth door Door-opener program

  1. AAn HC-05 Bluetooth module is connected via a serial connection to an Arduino Micro.
  2. The Arduino filters the serial data and extracts the MAC addresses that it finds.
  3. The discovered MAC addresses are compared against a whitelistwhite-list.
  4. Once a whitelistedwhite-listed device comes in range of the Bluetooth module AND passes a light barrier, the door opens.
  5. 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

  1. A HC-05 Bluetooth module is connected via a serial connection to an Arduino Micro.
  2. The Arduino filters the serial data and extracts the MAC addresses that it finds.
  3. The discovered MAC addresses are compared against a whitelist.
  4. Once a whitelisted device comes in range of the Bluetooth module AND passes a light barrier, the door opens.
  5. 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

  1. An HC-05 Bluetooth module is connected via a serial connection to an Arduino Micro.
  2. The Arduino filters the serial data and extracts the MAC addresses that it finds.
  3. The discovered MAC addresses are compared against a white-list.
  4. Once a white-listed device comes in range of the Bluetooth module AND passes a light barrier, the door opens.
  5. 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:

edited tags
Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237
Tweeted twitter.com/#!/StackCodeReview/status/500501209984565248
edited tags
Link
200_success
  • 144.2k
  • 22
  • 188
  • 473
Loading
deleted 220 characters in body; edited title
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237
Loading
added 859 characters in body
Source Link
Bavilo
  • 211
  • 1
  • 4
Loading
deleted 52 characters in body
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237
Loading
Source Link
Bavilo
  • 211
  • 1
  • 4
Loading