serial inputs
coldsprings
Posts: 14
I need one more input for a float switch. I already have a switch and a "go" button hooked up to Din9(p6) and Din10(p7). I have scoured the manual and a few pbasic books to possibly use Din1 to Din6 for my float switch, but haven't found much. I'm not even sure if I can use the shift registor for the float switch, and if I can then i'm not sure how to declare the input pin and such. I tried reversing Dout8 to use as an input but it switches states rapidly while the switch is making contact.
Any input would be greatly appreciated.
Any input would be greatly appreciated.
Comments
If your problem is not enough inputs, a 74HC165 shift register can provide more. There's a section of the StampWorks Manual (Experiment #24) that shows how (here).
The "switches states rapidly" could be contact bounce or the lack of a pullup or pulldown resistor. Follow the examples in the StampWorks Manual and in the "What's a Microcontroller?" tutorial on the use of switches.
The input on the stamp rapidly changes state wether or not I trigger the float switch. my code for the switch looks like:
ylight pin 10
float pin 9
btnwrk var byte
pause 5
button float, 0, 200, 20, btnwrk, 0, no_press
debug "Low fluid"
no_press:
do
pause 1000
low ylight
pause 1000
high ylight
pause 5000
loop until float = 0
goto main