Control a Basic Stamp using an LG Fathom Windows Mobile Phone.

pdablue

Active Member
Licensed User
Longtime User
Hi,

This Basic4PPC program example allows you to customize up to 20
individual buttons that can send data characters out an open Bluetooth
serial port connection.

This programming example allows you to control 8 output port pins
on a Basic Stamp using a Firefly-BP wireless Bluetooth adapter and
an LG Fathom Windows Mobile phone.

You can set individual output Port pins High or Low.

You can set all output Port pins High.

You can set all output Port pins Low.

You can press a button to Open the Bluetooth serial port connection.

You can press a button to Close the Bluetooth serial port connection.

You can press a button to Clear the text characters in the TX textbox
window.

You can press a button to Clear the text characters in the RX textbox
window.

You can enter individual characters or character strings into the TX
textbox window and press the "Send TX" button to transmit the
character(s) out the open serial port connection.

You can press a button to toggle the Soft Input Panel keyboard On
and Off.

You can press the "Clear All" button to clear the text characters
displayed on the buttons themselves and the data currently assigned
to each of the buttons.

You can check a button's Checkbox and Enter data into the
"Label" and "Value" textboxes and then assign the data to the
selected button by pressing the "Enter" button.

You can check a button's Checkbox and press the red "C" button
to clear the text and data for the selected button while leaving
all of the other buttons alone.

You can check a button's Checkbox and press the red "V" button
to view the data assigned to that particular button in the "Label"
and "Value" textboxes.

You can press the "RF" button to read the currently selected data
file (1 - 8), to load in previously saved data assignments for each
of the 20 buttons.

Once you customize the 20 buttons the way that you want you
can press the "SF" button to save the data that you have
assigned to all 20 buttons to the currently selected data file
(1 - 8).

You can save 8 different "20 key" customizations into 8 different
data files.

You can use the "Button" Menu selection on the bottom Menu Bar
to change the Font Size to 7, 8 or 9 for the text displayed on each
image button.

To see all of the data currently assigned to all 20 buttons at once
you can press the "View" button to see the current state of each
of the 20 buttons.

You can connect the TX and RX data lines together on your
Bluetooth adapter and perform the Range Test by pressing the
"RT" button. If the device is in communication range of the wireless
Bluetooth adapter the word "IN" will be displayed in the green box.
If the device is not in communication range of the wireless Bluetooth
adapter the word "OUT" will be displayed in the green box.

You can press the "ST" button to stop a currently running range test.

You can change the color of the 20 custom buttons by pressing the
"BUTTON" menu selection on the menu bar at the bottom of the screen.
You can then select from a pop up menu and change the color of the
20 buttons to: Red, Blue, Green, Yellow or Mixed.

When you press the "SF" button to save data for the 20 Custom
Buttons to a file you will be prompted by a message box asking if
you really want to write data to the file or not. Press "Yes" if you
want to continue and save data to the currently selected file (1 - 8).
Press "No" if you do not want to save data to the currently selected
file.

This example only uses 18 of the 20 available buttons leaving 2 as
spares. You can use 1 button or all 20 buttons or any number of
buttons in between.

Here is a listing of the code running on the Basic Stamp:

' {$STAMP BS2p}
' {$PBASIC 2.5}

serdata VAR Byte
valdata VAR Byte
Baud CON 240

INPUT 15

OUTPUT 0
OUTPUT 1
OUTPUT 2
OUTPUT 3
OUTPUT 4
OUTPUT 5
OUTPUT 6
OUTPUT 7

LOW 0
LOW 1
LOW 2
LOW 3
LOW 4
LOW 5
LOW 6
LOW 7

Main:

DO
SERIN 15,Baud,[serdata]

LOOKDOWN serdata,[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,89,90],valdata
BRANCH valdata,[c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16,c17,c18]
GOTO jumpend

c1:
'Character A was received. Set P0 High.
HIGH 0
GOTO jumpend

c2:
'Character B was received. Set P0 Low.
LOW 0
GOTO jumpend

c3:
'Character C was received. Set P1 High.
HIGH 1
GOTO jumpend

c4:
'Character D was received. Set P1 Low.
LOW 1
GOTO jumpend

c5:
'Character E was received. Set P2 High.
HIGH 2
GOTO jumpend

c6:
'Character F was received. Set P2 Low.
LOW 2
GOTO jumpend

c7:
'Character G was received. Set P3 High.
HIGH 3
GOTO jumpend

c8:
'Character H was received. Set P3 Low.
LOW 3
GOTO jumpend

c9:
'Character I was received. Set P4 High.
HIGH 4
GOTO jumpend

c10:
'Character J was received. Set P4 Low.
LOW 4
GOTO jumpend

c11:
'Character K was received. Set P5 High.
HIGH 5
GOTO jumpend

c12:
'Character L was received. Set P5 Low.
LOW 5
GOTO jumpend

c13:
'Character M was received. Set P6 High.
HIGH 6
GOTO jumpend

c14:
'Character N was received. Set P6 Low.
LOW 6
GOTO jumpend

c15:
'Character O was received. Set P7 High.
HIGH 7
GOTO jumpend

c16:
'Character P was received. Set P7 Low.
LOW 7
GOTO jumpend

c17:
'Character Y was received. Set P0,P1,P2,P3,P4,P5,P6,P7 High.
HIGH 0
HIGH 1
HIGH 2
HIGH 3
HIGH 4
HIGH 5
HIGH 6
HIGH 7
GOTO jumpend

c18:
'Character Z was received. Set P0,P1,P2,P3,P4,P5,P6,P7 Low.
LOW 0
LOW 1
LOW 2
LOW 3
LOW 4
LOW 5
LOW 6
LOW 7

jumpend:
LOOP ' repeat forever
END
 

Attachments

  • bluefly2.jpg
    bluefly2.jpg
    31.7 KB · Views: 234
  • stamppic2.jpg
    stamppic2.jpg
    62.3 KB · Views: 231
  • resized_cbtn6.jpg
    resized_cbtn6.jpg
    46.3 KB · Views: 223
  • custombtn5.sbp
    64.7 KB · Views: 260
Last edited:

pdablue

Active Member
Licensed User
Longtime User
A version with wider buttons.

Hi,

Here is a version of the "20 Custom Buttons" program with wider
buttons, which allows you to put more text characters on them.
 
Top