Thread: File Inclusion
View Single Post
  #3   Spotlight this post!  
Unread 15-03-2007, 21:14
sovierr's Avatar
sovierr sovierr is offline
Teacher Advisor
AKA: Rich Soviero
FRC #0180 (& FTC 283/284 - SPAM)
Team Role: Teacher
 
Join Date: Nov 2006
Rookie Year: 2006
Location: Jensen Beach, FL
Posts: 63
sovierr is on a distinguished road
Re: File Inclusion

Maybe you can just count up each time the limit switch is pressed. Then to check the state you can see if the limit switch counter variable is even or odd. You can do this by dividing by 2 and using the remainder (zero=even, 1=odd). I don't know the c commands for remainders, as I do most of my programming in VBScript. Usually there is a mod function that is a truncated division (gives the integer portion of the quotient and drops the remainder). IF you subtract the integer mod quotient from the real# quotient you can check the real # answer. If it is zero you've got an even #. If it is not zero you've got an odd number.

Than again, if you can;t use and absolute value function without including it, you probably won't be able to use a mod function either. Anyway, I hope this helps you to some degree.
Reply With Quote