Customizing
You'll run the same code on both CLUE boards. However, you first need to edit each one to setup the names you'll use. You set the name you want your board to broadcast to the world via MY_NAME
. You also need to set the name of the board for the friend you are looking for in FRIENDS_NAME
.
Look for these lines at the top of the code:
#--| User Config |--------------------------------------------------- MY_NAME = "ME" FRIENDS_NAME = "FRIEND" #--| User Config |---------------------------------------------------
and change them as you want. Just make sure the naming is symmetrical. That is, your friend should set FRIEND_NAME
to your MY_NAME
and vice versa.
When the other CLUE has been found, the message areas will change to indicate the name of the other CLUE (ex: FRIEND).
Now, on one of the CLUEs, press the A and B buttons together to connect.
You are now connected and ready to send messages.
The incoming message will appear in the upper area - the blue bar.
The outgoing message will appear in the lower area - the green bar.
Chatting
You chat one letter at a time.
Each letter is formed by using Morse Code, using Button A for DOT and Button B for DASH. Don't know Morse Code? Don't worry, that's why the majority of the screen is filled with a cheat sheet.
Once all the dots and dashes for a letter have been entered, press BOTH buttons to send the letter.
NOTE: a space is generated by just sending a blank letter.
- A = DOT
- B = DASH
- A + B = SEND letter
Each DOT/DASH will appear in the code entry area [ ] as you press the buttons.
In this example the other CLUE(FRIEND) has sent the message HOW RU which has been received and displayed in the upper area.
This CLUE (yours) has sent IM GOOD which is displayed in the lower area.
Disconnecting
If either CLUE disconnects for some reason, the other CLUE should detect this and revert back to Scanning... mode. Then, if the disconnected CLUE comes back, it will be seen and you can reconnect and start over.
To talk to a different CLUE, you will need to re-edit the code on each to set the names.
Pro Mode Tweaks
As you get better at typing in the Morse Code, you may find that the buttons are reacting a little too slow for your liking. This is due to the delay that is used for debouncing the button presses. You can try speeding things up by tweaking these delay values. Look for these lines of code at the top:
WAIT_FOR_DOUBLE = 0.05 DEBOUNCE = 0.25
You can try reducing them down a bit. Start with reducing the main DEBOUNCE
setting value. The WAIT_FOR_DOUBLE
value determines how quickly you must press A+B for it to register as a double button press vs. two single presses. Unless you're a ninja robot, you'll probably need some of this.
Running On Other Hardware
This code could be adapted to work on other hardware configurations. The main items used are:
- BLE
- A display
- Two buttons
The code and artifacts were all written assuming a 240x240 pixel display. The TFT Gizmo has that same size, so this code will run with only minor modifications on a Circuit Playground Bluefruit with a TFT Gizmo. For other display sizes, you'll need to rework the text label locations. You'll also need a different sized BMP for the backgorund. You could simply scale the provided BMP, but here's the SVG used in case you want to hack further:
Page last edited March 08, 2024
Text editor powered by tinymce.