Transferring values from Ultrasonic Distance Sensor to LCD
Synixer
Posts: 3
Hi! so im going to a sort of recruiting confrence in Norway on monday in an attempt to recruit students to pursue Computer science here. in this attempt ive made a
Boe-Bot with 2 Micro controller cards. i have one for controlling the bot ofc the other one im using a Ultrasonic Distance Sensor to display lenghts. its cool enough in itself BUT i want to transfer the values it shows in CM and " to a Parallax 2 x 16 Serial LCD ( Backlit) screen. the code for the Sensor is this :
CmConstant CON 2260
InConstant CON 890
cmDistance VAR Word
inDistance VAR Word
time VAR Word
DO
PULSOUT 15, 5
PULSIN 15, 1, time
cmDistance = cmConstant ** time
inDistance = inConstant ** time
DEBUG HOME, DEC3 cmDistance, " cm"
DEBUG CR, DEC3 inDistance, " in"
PAUSE 100
LOOP
now i need a code for the LCD to kind of use this as a source. either i merge the programs but im not sure how. or i try to get it to use the Debug Terminal ( where the values show when i run the Sensor ) as a source. anyone got any idea? im flying to a collage on monday so im kinda stressed out :I
Boe-Bot with 2 Micro controller cards. i have one for controlling the bot ofc the other one im using a Ultrasonic Distance Sensor to display lenghts. its cool enough in itself BUT i want to transfer the values it shows in CM and " to a Parallax 2 x 16 Serial LCD ( Backlit) screen. the code for the Sensor is this :
CmConstant CON 2260
InConstant CON 890
cmDistance VAR Word
inDistance VAR Word
time VAR Word
DO
PULSOUT 15, 5
PULSIN 15, 1, time
cmDistance = cmConstant ** time
inDistance = inConstant ** time
DEBUG HOME, DEC3 cmDistance, " cm"
DEBUG CR, DEC3 inDistance, " in"
PAUSE 100
LOOP
now i need a code for the LCD to kind of use this as a source. either i merge the programs but im not sure how. or i try to get it to use the Debug Terminal ( where the values show when i run the Sensor ) as a source. anyone got any idea? im flying to a collage on monday so im kinda stressed out :I
Comments
SEROUT TX,LcdBaud,[LcdLine1,DEC3 cmDistance," cm "]
SEROUT TX,LcdBaud,[LcdLine2,DEC3 inDistance," in "]
The constant declarations in the Template assume that the LCD is connected to I/O pin 0. Read the documentation for the LCD for details of how to use it.
Thx! i used some example code that had 19200 baud set as 82 or something. that made the error. now it works just fine