Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #no_data
- #no_table
- ; Configure the i2c mode and the i2c bus
- ; hi2csetup i2cslace, slaveaddress
- hi2csetup i2cslave, %00100000
- Symbol dangerLevel = 70 ; Distance before LED should turn on.
- ; main method
- main:
- debug
- readadc 0, b1 ; read the analog inputs.
- if b1 < dangerLevel then
- gosub danger
- else
- gosub noDanger
- endif
- goto main ; Loop back to start
- noDanger: ; Turn the LED off
- low B.1
- return
- danger: ; Turn the LED on
- high B.1
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement