Main Area and Open Discussion > Living Room
Bluetooth Power Monitor
Asudem:
Bluetooth Power Monitor
So I've discovered the power of EAGLE cad software and oh my goodness, this is amazing! I will have a fantastic looking prototype!
tomos:
^ the drawing looks great :up:
Asudem:
^ the drawing looks great :up:
-tomos (February 27, 2016, 02:16 PM)
--- End quote ---
Thanks, here's the first Rev. 00 I've submitted for printing! I'm very excited! :D
Bluetooth Power Monitor
Asudem:
Perhaps I might receive better feedback here over the official support forums: I have made a little program to test the logic of the microcontroller of the device.
In many examples created by the manufacturer, to wait for a bluetooth connection in the setup() routine, the following code is used:
--- --- /* Wait for connection */
while (! ble.isConnected()) {
delay(500);
}And it works correctly. However calling this from within the loop() method yields.... interesting results.
The logic of the Feather's microcontroller is tested in 4 ways:
If the bluetooth module is not connected, it should return false.
--- --- if (!ble.isConnected())
{
printBoth(F("True"));
}
else
{
printBoth(F("False"));
}If the bluetooth module's connected status is false, it should return false.
--- --- if (ble.isConnected() == false)
{
printBoth(F("True"));
}
else
{
printBoth(F("False"));
}If the bluetooth module is not connected or if the bluetooth module is not connected, it should return false.
--- --- if (!ble.isConnected() || !ble.isConnected())
{
printBoth(F("True"));
}
else
{
printBoth(F("False"));
}If the bluetooth module is connected, it should return 1.
--- ---printBoth(String(ble.isConnected()));Where "printBoth" is simply a function which outputs the string to both the Serial and bluetooth for display. If I run the program with an incremental timer, here are the results:
Test#, Delay in Seconds, Test 1 results, Test 2 results, Test 3 results, Test 4 results
* 0, True, True, True, 0
* 1, False, True, True, 0
* 2, False, True, True, 0
* 3, False, True, True, 0
* 4, False, True, True, 0
* 4, False, True, False, 0
So, I thought that was strange, but check this out....
* 4, False, True, False, 0
* 4, False, True, False, 0
* 4, False, True, False, 0
* 4, False, True, True, 0
* 4, False, True, False, 0
* 4, False, True, False, 0
So yeah, I don't know what's going on, but I don't know what to believe anymore...
Stoic Joker:
--- Code: C# ---if (!ble.isConnected()) { printBoth(F("True")); } else { printBoth(F("False")); }
...Okay, am I completely off my nut...or does this really read as:
If it's true, that connection is false, print true?? ...I don't think the '!' is helping the output's clarity any.
I know nothing about the BT controller you're working with, but that code just strikes me as painfully confusing to work with.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version