Advertisement
aymondelbridge

Untitled

Jun 29th, 2013
2,908
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pic 16 0.47 KB | None | 0 0
  1. #no_data
  2. #no_table
  3. ; Configure the i2c mode and the i2c bus
  4. ; hi2csetup i2cslace, slaveaddress
  5. hi2csetup i2cslave, %00100000
  6. Symbol dangerLevel = 70 ; Distance before LED should turn on.
  7. ; main method
  8. main:
  9.     debug
  10.     readadc 0, b1 ; read the analog inputs.
  11.     if b1 < dangerLevel then
  12.         gosub danger
  13.     else
  14.         gosub noDanger
  15.     endif      
  16.     goto main   ; Loop back to start
  17.  
  18. noDanger:       ; Turn the LED off
  19.     low B.1
  20.     return
  21.    
  22. danger:         ; Turn the LED on
  23.     high B.1
  24.     return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement