Sign in

username:

password:



Not a member?

Search oopic



Search tips

Subscribe to oopic



Ads

Discussion Groups

Discussion Groups | | how to use the convet the feet to cm using the oSonarDV object? thanks

how to use the convet the feet to cm using the oSonarDV object? thanks - aibomc - Feb 5 21:35:10 2008

Dear sir,

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



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )


Re: how to use the convet the feet to cm using the oSonarDV object? thanks - ooPIC Tech Support - Feb 5 23:08:39 2008

cm = feet*12*2.54
1 foot = 12 inches
1 inch = 2.54cm

DLC

aibomc wrote:
> Dear sir,
>
> 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
>
>
>
>
>
>



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )