TLS235R Demo Code for BS2
Steve K
Posts: 3
I bought a couple of TSL235R and TLS237 but I cannot find any Demo Code for BS2 it seems that Parallax does not supply demo code on the download site and I do not see any in the forums. I don't know where to start.
Comments
Here is some code I had for the old TSL230R Light-to-Frequency converter...
It should also work with the two devices you have.
-Phil
Both these code snippets work:
They're pretty much the same
Thanks again
' {$STAMP BS2e}
' {$PBASIC 2.5}
'
Define variables, set status of pins
x VAR Word
cnt VAR Word
'
Constant declarations
'S0 PIN 0 'Sensitivity selection pins
'S1 PIN 1
In PIN 8 'TSL230R output pin
'
Program Start
'LOW S0 'Set sensitivity pins (S0,S1) to x10
'HIGH S1
'
Main program loop
READER:
FOR x = 1 TO 2000
COUNT In, 100, cnt 'COUNT on P2 FOR 100 ms, store value in cnt
DEBUG HOME, DEC5 cnt 'Display value of cnt as a decimal
NEXT
GOTO READER
END
and
' {$STAMP BS2e}
TSL230 CON 8
light VAR Word
LOOP:
COUNT TSL230,100,light
DEBUG HOME,DEC5 light,CR
PAUSE 100
GOTO LOOP