Addition on a pin
Archiver
Posts: 46,084
This is sort of a repost but I am stuck. I need to add changes of
voltage on a pin which goes from 0-1 using a photoresistor as a
sensor. The number of 1's over the interval (one minute) will give
me the number I need. I have gotten as far as having my sensor give
me the appropriate changes but I cant find an appropriate program to
add the ones and store them. Any steering in towards manuals would
be appreciated. I have looked through WAM and Applied Sensors
without much luck.
Thank you
Mike Z
voltage on a pin which goes from 0-1 using a photoresistor as a
sensor. The number of 1's over the interval (one minute) will give
me the number I need. I have gotten as far as having my sensor give
me the appropriate changes but I cant find an appropriate program to
add the ones and store them. Any steering in towards manuals would
be appreciated. I have looked through WAM and Applied Sensors
without much luck.
Thank you
Mike Z
Comments
>This is sort of a repost but I am stuck. I need to add changes of
>voltage on a pin which goes from 0-1 using a photoresistor as a
>sensor. The number of 1's over the interval (one minute) will give
>me the number I need. I have gotten as far as having my sensor give
>me the appropriate changes but I cant find an appropriate program to
>add the ones and store them. Any steering in towards manuals would
>be appreciated. I have looked through WAM and Applied Sensors
>without much luck.
>Thank you
>
>Mike Z
Mike -
Take a look at the COUNT command in the manual or the HELP file and see if
it will do what you need it to do.
Regards,
Bruce Bates
any manual. Here's an idea off the top of my head -- and at the end of
a long day so it may not work....
Sensor PIN 0
idx VAR Word
lastState VAR Bit
Main:
GOSUB Get_Changes
DEBUG CLS, "Changes = ", DEC changes
END
Get_Changes:
changes = 0
lastState = 0
FOR idx = 1 TO 600
IF (Sensor = 1) AND (lastState = 0) THEN
changes = changes + 1
ENDIF
lastState = Sensor
PAUSE 100
NEXT
The resolution is 100 millisecond -- you can adjust this as required,
just remember to adjust the FOR-NEXT loop count as well.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: mziegler1485 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=ZzID62Po5HVr48GJMs2YwyOr5e-PQaMOkIYwzhN_rM2NYf06EMGqrNo4THf1zWaDEvsLYMe66R__UCKa]mziegler@h...[/url
Sent: Monday, June 28, 2004 8:29 PM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Addition on a pin
This is sort of a repost but I am stuck. I need to add changes of
voltage on a pin which goes from 0-1 using a photoresistor as a
sensor. The number of 1's over the interval (one minute) will give
me the number I need. I have gotten as far as having my sensor give
me the appropriate changes but I cant find an appropriate program to
add the ones and store them. Any steering in towards manuals would
be appreciated. I have looked through WAM and Applied Sensors
without much luck.
Thank you
Mike Z