ROBODYSSEY SYSTEMS LLC
Product Catalog
Code Page
Policies
Gallery
Whats New
Press Releases
Resources
Links
Contact Us
About Us
Press
Educators Page
BasicX and Robotics book
After School
Mini Challenge!
Free Robots to Kids
Hack-A-Toy
Shopping Cart
Page17_9
Home Product Catalog Shopping Cart Resources Links
Code Page Policies Gallery

A to D


PIC Home Previous Page Next Page Next Chapter

Page: 1 2 3 4 5 6 7 8 9

Here is data from the photo-resistor in the light.

Here is data from the photo-resistor in the dark.

You are ready to program

Copy and Pastable code


Be sure to create a new project first.
For a review of creating projects please go here
Paste BELOW your program name!
PROGRAM NAME CREATED VIA NEW PROJECT!!
COPY AND PASTE FROM NEXT LINE DOWN
'***********************************
Dim data1 as Integer
'***********************************
Sub Procedure GetValA1
    TrisA = %00000000 ' Set Pins on PortA to Output
    data1 = 1         ' Set the data variable to 1
    PortA = %00000010 ' Pulse pin 1 on PortA for 5ms
    Delay_ms(5)
    TrisA = %00000010 ' Get ready to suck in data
Counts:
    If Testbit(PortA,1) = 1 Then  'See how long it takes to
                                  'discharge the capacitor
       data1 = data1 + 1
       Goto Counts
    End If
    PortB = data1
End Sub
 '***********************************
 Main:
    TrisB = %0000000
    TrisA = %0000000
    CMCON = %00000111
 Mainloop:
    GetValA1
 Goto Mainloop
 End.
PIC Home Previous Page Next Page Next Chapter

Page: 1 2 3 4 5 6 7 8 9

Robodyssey and the Robodyssey logo are trademarks of Robodyssey Systems, LLC
PIC is a registered trademark of Microchip Technology Inc. in the U.S. and other countries.
MikroBasic is a registered trademark of mikroElectronika Inc. in the U.S. and other countries.
Home Product Catalog Shopping Cart Resources Links
Code Page Policies Gallery