Shop OBEX P1 Docs P2 Docs Learn Events
Converting BS1 to BS2 — Parallax Forums

Converting BS1 to BS2

ArchiverArchiver Posts: 46,084
edited 2000-05-31 06:19 in General Discussion
Hello all
I am doing a project for school and i am using a Basic stamp 2 . I am
making a robot that is controlled by the computer and can take
temperature and humidity readings. I am using the humidity/temperature
kit made by facinating electronics. There is a section in the stamp
manual on using this with the stamp. Altho the program is written for
use with BS1. Every time i try to load the program onto the stamp it
says the stamp is detected but it doesn't comes up with an error
telling me to check the power supply. I figured tat might be because
the Humid program is a *.Bas file and BS2 maynot be able to reconginse
this. So i copied the entire contents into a *.BS2 file and then the
program comes up with syntax errors. The program is below. Can someone
please assist me in converting this program to one that i can use on
the BS2. Thanks for your help.

' Program HUMID.BAS
' The Stamp interfaces to an inexpensive Temperature/humidity sensor
kit. Data from the sensors is displayed on the host PC using the debug
command. This program does not include routines for calibration or
conversion, presenting instead raw timing data from 'the sensors.

Symbol temp = w4 ' Temperature <-- Error
Symbol RH = w5 ' Humidity <-- Error

' The main program loop reads the sensors and displays
' the data on the PC screen until the user presses a
' key. Remember that even when the debug screen is not
' displayed, the Stamp is still active. Disconnect it
' to conserve battery power.

Loop:
input 0:input 2: output 3
low 2: low 3
Let temp = 500 <-- error on "Let"

ReadTemp:
output 1: low 1
pause 1
input 1
pulsout 2, temp
If pin1 = 1 Then ReadRH <-- error on "pin"
Let temp = temp + 1 <-- error on "Let"
GoTo ReadTemp

ReadRH:
high 3
pause 500
pulsin 0, 1, RH
low 3
debug temp
debug RH
goto Loop


Thanks very much for your help.
regards
-Pointybeard



__________________________________________________________________
Get your free Australian email account at http://www.start.com.au

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-05-31 06:19
    BS2 syntax for your problem lines:
    temp var word
    RH var word
    temp = 500
    If in1 = 1 Then ReadRH
    temp = temp + 1
    debug dec temp
    debug dec RH
Sign In or Register to comment.