This Forum is Dedicated For all The Object Oriented PIC Lovers .......... The concept behind OOPic is straight forward. Use preprogrammed multitasking Objects from a library of highly optimized Objects to do all the work of interacting with the hardware. Then write small scripts in Basic, C, or Java syntax styles to control the Objects. During operation, the Objects run continuously and simultaneously in the background while the scripts run in the foreground telling the objects what to do.

Tuesday, February 5, 2008

[oopic] how to use the convet the feet to cm using the oSonarDV object? thanks

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



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:

http://docs.yahoo.com/info/terms/

No comments: