RCtime decay
stilgar
Posts: 47
I am having trouble getting this code to stop when r_time reaches a number. for this example "5".
I think I should use "case" but I still don't understand how to use it.
any help to understand the case command in this example would greatly be appreciated.
thanks
stilgar
I think I should use "case" but I still don't understand how to use it.
any help to understand the case command in this example would greatly be appreciated.
thanks
stilgar
Comments
You don't really need to use case in the example. A simple if statement is enough to check for equality.
Indentation is part of the Spin syntax. It's confusing when you add apparently random indentations.
I changed the end of the program to this.
I added a constant "_NumberToMatch" in the CON section.
I think the above changes should make the program stop once rtime/1200 equals five.
It's not a pretty way to end a program (while still inside a loop) but I didn't want to add any more code than absolutely necessary.
Edit: I'm not sure why r_time is used. In the attached code the loop continuously displays r_time but rtime is the variable being updated.