need info on for next code
allie
Posts: 109
I have relays hooked to the BS2 on pins p13 and p14. p13 and p14 hook to my control board, all works well.
I need help with the code.
I would like to know if this can be done and how?
I'll start.
For controller = 1 to 198
' Turn on relay 1 when numbers are odd
' Turn on relay 2 when numbers are even
Code here
next controller
allie
I need help with the code.
I would like to know if this can be done and how?
I'll start.
For controller = 1 to 198
' Turn on relay 1 when numbers are odd
' Turn on relay 2 when numbers are even
Code here
next controller
allie
Comments
How about giving a try for the code. There are lots of ways to do what you want. How do you tell whether something is odd or even?
controller and 1 = 1 it's odd.
controller and 1 = 0 it's even.
Does the Stamp have a bitwise test function?
It's the code for the for next loop. I almost have it worked out and I'll let you know when I'm finished. I'll try to get a diagram with express sch tomorrow.
Thanks for the other two replys. I was reading up on the math instructions from the BS2 online manual.
allie
' {$STAMP BS2}
' {$PBASIC 2.5}
controller VAR Byte
FOR controller = 1 TO 198
IF controller/2*2=controller THEN DEBUG DEC controller," even",CR
IF controller/2*2<>controller THEN DEBUG DEC controller," odd",CR
PAUSE 50
NEXT