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 module using Basic4PPC.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-11-2010, 08:44 AM
pdablue's Avatar
Senior Member
 
Join Date: Sep 2007
Posts: 114
Arrow Control a Basic Stamp module using Basic4PPC.

Hi,

This program example allows you to control Output Pins P0 thru P7
on a Basic Stamp using a BlueTooth module and a HP210 PDA running
this Basic4PPC program.

When you press a button the PDA will send a one byte character command
to the Basic Stamp using a wireless BlueTooth connection. The program
running on the Basic Stamp will analyze the single byte character and
take the appropriate action.

This program example allows you to set each Basic Stamp Port Pin
(P0 thru P7) High or Low individually.

You can also set all Port Pins (P0 - P7) High at one time.
You can also set all Port Pins (P0 - P7) Low at one time.

You can Open and Close the BlueTooth Communications Port.

You can clear the TX and RX windows.

When you press a button the character that is transmitted is displayed in
the TX window. If your hardware sent a character back to the PDA it
would be displayed in the RX window.

Port pin P15 on the Basic Stamp is used to receive serial data from the
wireless BlueTooth connection with the PDA.

The RS232 module is plugged into the BlueTooth module to convert
the received data into TTL voltage levels before it enters Port pin
P15 on the Basic Stamp.

Here is a listing of the program code that runs on the Basic Stamp:

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

serdata 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]

'Character A was received. Set P0 High.
IF serdata=65 THEN
HIGH 0
ENDIF

'Character B was received. Set P0 Low.
IF serdata=66 THEN
LOW 0
ENDIF

'Character C was received. Set P1 High.
IF serdata=67 THEN
HIGH 1
ENDIF

'Character D was received. Set P1 Low.
IF serdata=68 THEN
LOW 1
ENDIF

'Character E was received. Set P2 High.
IF serdata=69 THEN
HIGH 2
ENDIF

'Character F was received. Set P2 Low.
IF serdata=70 THEN
LOW 2
ENDIF

'Character G was received. Set P3 High.
IF serdata=71 THEN
HIGH 3
ENDIF

'Character H was received. Set P3 Low.
IF serdata=72 THEN
LOW 3
ENDIF

'Character I was received. Set P4 High.
IF serdata=73 THEN
HIGH 4
ENDIF

'Character J was received. Set P4 Low.
IF serdata=74 THEN
LOW 4
ENDIF

'Character K was received. Set P5 High.
IF serdata=75 THEN
HIGH 5
ENDIF

'Character L was received. Set P5 Low.
IF serdata=76 THEN
LOW 5
ENDIF

'Character M was received. Set P6 High.
IF serdata=77 THEN
HIGH 6
ENDIF

'Character N was received. Set P6 Low.
IF serdata=78 THEN
LOW 6
ENDIF

'Character O was received. Set P7 High.
IF serdata=79 THEN
HIGH 7
ENDIF

'Character P was received. Set P7 Low.
IF serdata=80 THEN
LOW 7
ENDIF

'Character Q was received. Set P0,P1,P2,P3,P4,P5,P6,P7 High.
IF serdata=81 THEN
HIGH 0
HIGH 1
HIGH 2
HIGH 3
HIGH 4
HIGH 5
HIGH 6
HIGH 7
ENDIF

'Character R was received. Set P0,P1,P2,P3,P4,P5,P6,P7 Low.
IF serdata=82 THEN
LOW 0
LOW 1
LOW 2
LOW 3
LOW 4
LOW 5
LOW 6
LOW 7
ENDIF

LOOP
END


When you run the Basic4PPC program on the PDA you will need to Open the Bluetooth serial port connection first.
If you do not then you will get error messages when you press a button and the program tries to send a character
out the serial port. If the port is closed when you push a button then you will get an error message.

This Basic4ppc program was written to run on a HP210 PDA.

The file MicroInstall.zip is the zipped up .CAB installation file for the PDA.
The file MICRO.sbp is the Basic4PPc source code file.
The file serialmicro.txt is the code for the Basic Stamp.
Attached Images
File Type: jpg bluefly2.jpg (31.7 KB, 34 views)
File Type: jpg bstamp2.jpg (77.6 KB, 19 views)
File Type: jpg stamppic2.jpg (62.3 KB, 24 views)
File Type: jpg micropic2.jpg (66.5 KB, 19 views)
File Type: jpg RS232.jpg (75.7 KB, 22 views)
File Type: jpg hp210pic2.jpg (41.6 KB, 25 views)
Attached Files
File Type: sbp MICRO.sbp (10.9 KB, 33 views)
File Type: txt serialmicro.txt (1.8 KB, 28 views)
File Type: zip MicroInstall.zip (77.2 KB, 30 views)

Last edited by pdablue : 09-11-2010 at 10:39 AM.
Reply With Quote
  #2 (permalink)  
Old 09-26-2010, 02:21 AM
Newbie
 
Join Date: Dec 2009
Posts: 8
Default

This is exactly what I needed Microcontroller to PocketPC communication over bluetooth.

Do you have links or names for the bluetooth module or the RS232 adapter?
Reply With Quote
  #3 (permalink)  
Old 09-26-2010, 08:49 AM
taximania's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire. UK
Posts: 592
Awards Showcase
Beta Tester 
Total Awards: 1
Default

More of the same here on my website.
Electronics
__________________
.
.
.
Don't ask, I'm fine, honest. !!
.
.
.
Just a little crazy at times



O2 XDA, GW Evo 2.1 UC WWE Rom, WM6.1
Radio Ver 03.34.90
With Basic4ppc V6.80


http://www.taximania.co.uk
Reply With Quote
  #4 (permalink)  
Old 09-29-2010, 05:33 AM
pdablue's Avatar
Senior Member
 
Join Date: Sep 2007
Posts: 114
Smile Bluetooth Modules and RS232 adapters.

Hi,

I purchased the Firefly-BP (Battery Powered) module from a company
called Grid Connect. You can Google them to find their website on the
Internet.

I purchased an RS232 module from Kronos Robotics (www.kronosrobotics.com).
It is called the "Easy RS232 Interface Kit". The one I have I purchased several
years ago and the new ones that Kronos currently sells look different due to a
different Printed Circuit Board layout. You can find them listed in the
"Easy Modules" section of their website.

SparkFun Electronics sells some RS232 modules and they can be
found at many of the Hobby Robotics\Electronics websites on
the Internet.

Last edited by pdablue : 09-29-2010 at 05:39 AM.
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
Some basic questions about Basic4ppc daniel3000 Questions (Windows Mobile) 5 12-31-2009 09:51 AM
A Basic4ppc program for the EZKEY module. pdablue Share Your Creations 0 03-22-2009 05:48 PM
Is there any thing like Visual Basic "Tabbed dialog control" in Basic4ppc? mozaharul Questions (Windows Mobile) 6 03-23-2008 11:07 AM
Use Basic4ppc to send serial data from a PDA to a BlueSMiRF Bluetooth module. pdablue Share Your Creations 3 11-19-2007 09:58 PM
Basic4ppc vs Other Basic Apps? ArchiMark Questions (Windows Mobile) 8 09-07-2007 03:31 PM


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