Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Share Your Creations
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Share Your Creations Show your developed application to Basic4ppc community. Please include source code if possible.

Control a Basic Stamp with B4PPC and a LG Fathom Windows Mobile Phone.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-13-2010, 03:39 PM
pdablue's Avatar
Senior Member
 
Join Date: Sep 2007
Posts: 114
Arrow Control a Basic Stamp with B4PPC and a LG Fathom Windows Mobile Phone.

Hi,

This program example will allow you to control Output port pins on
a Basic Stamp using an LG Fathom Windows Mobile Phone and a wireless
BlueTooth module.

You can control 12 of the Basic Stamps Output pins (P0 - P11).
Port pin P15 is used to receive data from the Bluetooth module.
Port pins P12, P13 and P14 are not used and can be used for
other things.

You can set Port Pins (P0 - P11) High or Low individually.
You can set all Port Pins (P0 - P11) High at one time.
You can set all Port Pins (P0 - P11) Low at one time.

You can Open and Close the Bluetooth Serial Communications
port.

You can Clear the TX and RX windows. When a button is pressed,
the single byte character command that is transmitted is displayed
in the TX window. If the external hardware sent data back to the
PDA it would be displayed in the RX window.

The LG Fathom runs the B4PPC program which sends data commands
to the wireless bluetooth adapter which is plugged into an RS232
converter board that is connected to Port Pin 15 of the Basic Stamp.
When a single byte character command is received by the Basic Stamp
it will analyze it and perform the specified action.

Here is a listing of the Basic Stamp program code:

' {$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
OUTPUT 8
OUTPUT 9
OUTPUT 10
OUTPUT 11

LOW 0
LOW 1
LOW 2
LOW 3
LOW 4
LOW 5
LOW 6
LOW 7
LOW 8
LOW 9
LOW 10
LOW 11

Main:

DO
SERIN 15,Baud,[serdata]

LOOKDOWN serdata,[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81 ,82,83,84,85,86,87,88,89,90],valdata
BRANCH valdata,[c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15 ,c16,c17,c18,c19,c20,c21,c22,c23,c24,c25,c26]
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 Q was received. Set P8 High.
HIGH 8
GOTO jumpend

c18:
'Character R was received. Set P8 Low.
LOW 8
GOTO jumpend

c19:
'Character S was received. Set P9 High.
HIGH 9
GOTO jumpend

c20:
'Character T was received. Set P9 Low.
LOW 9
GOTO jumpend

c21:
'Character U was received. Set P10 High.
HIGH 10
GOTO jumpend

c22:
'Character V was received. Set P10 Low.
LOW 10
GOTO jumpend

c23:
'Character W was received. Set P11 High.
HIGH 11
GOTO jumpend

c24:
'Character X was received. Set P11 Low.
LOW 11
GOTO jumpend

c25:
'Character Y was received. Set P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11 High.
HIGH 0
HIGH 1
HIGH 2
HIGH 3
HIGH 4
HIGH 5
HIGH 6
HIGH 7
HIGH 8
HIGH 9
HIGH 10
HIGH 11
GOTO jumpend

c26:
'Character Z was received. Set P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11 Low.
LOW 0
LOW 1
LOW 2
LOW 3
LOW 4
LOW 5
LOW 6
LOW 7
LOW 8
LOW 9
LOW 10
LOW 11

jumpend:
LOOP ' repeat forever
END
Attached Images
File Type: jpg microlg1.jpg (46.8 KB, 28 views)
File Type: jpg styluslg1.jpg (54.0 KB, 19 views)
File Type: jpg Capture2.jpg (69.7 KB, 25 views)
File Type: jpg micro12r.jpg (75.7 KB, 24 views)
File Type: jpg stamppic2.jpg (62.3 KB, 25 views)
Attached Files
File Type: sbp microcom12.sbp (14.9 KB, 18 views)
File Type: txt serial12micro.txt (2.6 KB, 25 views)
File Type: zip micro12install.zip (79.3 KB, 22 views)

Last edited by pdablue : 10-10-2010 at 03:06 PM.
Reply With Quote
  #2 (permalink)  
Old 04-20-2011, 07:53 AM
Newbie
 
Join Date: Apr 2011
Posts: 1
Default

Hi,

i am doing a similar project, i am new to this and i was hoping to learn from you.
I have a few questions,

1) I am using Parallax Easy Bluetooth module and Board of education
2) Windows mobile SDK professional 6.0 as an emulator

i have tried using the code you have provided and when i used the emulator, it could detect the easy bluetooth, but it does not respond when i tried to control it with the emulator. Can you guide me on this ?

I modified part of the code as per below as i am using the easy bluetooth instead:
Instead of LOOKDOWN and BRANCH, i used IF and ELSEIF as my program is relatively short, using only pin 1 for testing lighting up and LED.

RX PIN 2 ' RX of the Easy Bluetooth
TX PIN 0 ' TX of the Easy Bluetooth

Baud CON 84 ' Baud set at 9600

'
SERIN RX, Baud, [Sig_IN] ' receive input from user

IF (Sig_IN = "0") THEN 'Turn on LED

OUT1=0

ELSEIF (Sig_IN = "1") THEN 'Turn off LED

OUT1=1

Last edited by jiahuiistheleader01 : 04-20-2011 at 08:02 AM.
Reply With Quote
  #3 (permalink)  
Old 04-22-2011, 03:26 PM
pdablue's Avatar
Senior Member
 
Join Date: Sep 2007
Posts: 114
Smile Windows Mobile Emulator Question.

Hi,

I have not used the Windows Mobile Emulator, I do all of my testing either
on a PDA or a Windows Mobile Phone.

I do not know how the Emulator actually handles emulation of the Com Port.

I would suggest that you try an actual PDA or a Windows Mobile Phone
to test your code.

If you want to use the Emulator you may have to modify the Com Port
settings until you find a setting that actually sends and receives data
with the hardware setup that you are using.
Reply With Quote
  #4 (permalink)  
Old 05-19-2011, 04:33 PM
Newbie
 
Join Date: May 2011
Posts: 4
Default

Hi, i have a similar problem as well. I created all my buttons with the desktop IDE and complied it into .exe , from there i followed the instructions under the tutorial by loading it with a mobile emulator so it works like a real phone. how ever i am quite stuck(sorry i am a noob, even after reading so many tutorials). I realised that i do not know what are the parts that are needed to connect my phone with the easy bluetooth. i noticed that in ur phone app, we can select com port and stuff(my TX RX and default written into basic stamp), how can i do that too?

i.e. i created my buttons, how i can connect basic stamp and basic4ppc so that when i press the button, a signal is sent over to the basic stamp? sorry i do not know much about bluetooths.
Reply With Quote
  #5 (permalink)  
Old 05-24-2011, 04:38 PM
pdablue's Avatar
Senior Member
 
Join Date: Sep 2007
Posts: 114
Smile (.exe) app on a Desktop communicating with a Basic Stamp.

Hi,

If you have written your application to run as a stand alone (.exe)
program on a desktop computer, you can connect the desktop
computer to a Basic Stamp using a RS232 serial port cable.

You will need to write your application so that it uses the SerialEx.Dll
to open and close the Desktop computer serial port. You will have to
experiment with your Desktop computer to find out which com port is
available for your application to use: (com1, com2, com3, ... etc.)

You will need an RS232 Interface IC to connect the serial port cable
from the desktop to the Basic Stamp's port pin(s). You can connect
up to just one of the Basic Stamp's port pins if you just want to
receive characters from the Desktop computer.

If you write your application to run as a stand alone (.exe) file, you
will not need to use the emulator.


(Desktop Computer) <------ RS232 Serial Cable ------ RS232 Interface IC -----> (Basic Stamp)

For more Bluetooth info you can visit the following websites:

http://www.micropda.50webs.com/index.html

http://www.stormpages.com/microbox/index.html

Last edited by pdablue : 05-24-2011 at 04:50 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Control a Basic Stamp module using Basic4PPC. pdablue Share Your Creations 3 09-29-2010 05:33 AM
Programs for a LG Fathom Window Mobile Phone. pdablue Share Your Creations 0 08-04-2010 09:34 PM
Unterschied zwischen Windows CE und Windows Mobile Grolle German Forum 3 02-17-2009 12:10 PM
VBA for Windows mobile(?) Cableguy Chit Chat 3 08-29-2008 07:20 AM
Windows Mobile 6.1 and .NET CF Christian22 Questions (Windows Mobile) 5 05-17-2008 08:32 AM


All times are GMT. The time now is 12:40 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0