Could you kindly tell me how to use the convet the feet to cm using
the oSonarDV object?
thanks
Michael Chan
' Date: 16-11-2007
' Name: Michael Chan
'File Name: Sonar_(4)
' Function: This program is function test the SRF04 sonar with display
' SONAR objests:
Dim Sonar As New oSonarDV
Dim LCD As New oLCDSE
Sub main()
Sonar.IOLineP = 3
Sonar.IOLineE = 4
LCD.IOLine = 16
LCD.Clear
Do
Sonar.Operate = 0
Sonar.Operate = 1
While Sonar.Received = cvFalse
Wend
LCD.Locate(1,0)
If Not Sonar.TimeOut Then
printData(Sonar/64)
LCD.String = "."
printData(Sonar Mod 64*100/64)
LCD.String = "cm"
Else
LCD.String = "Out of Range"
End If
ooPIC.Delay = 100
Loop
End Sub
Sub printData(wt As Byte)
Dim wtemp As Byte
Dim btemp As Byte
Dim mtemp As Byte
btemp = 0
mtemp = 0
wtemp = 100
While wtemp > 0
mtemp = wt/wtemp
If ((mtemp > 0) Or (btemp = 1) Or (wtemp = 1)) Then
wt = wt - mtemp*wtemp
btemp = 1
LCD.Value = mtemp + 48
End If
If wtemp = 1 Then
wtemp = 0
Else
wtemp = wtemp/10
End If
Wend
End Sub
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/oopic/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/oopic/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
No comments:
Post a Comment