|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Photoswitch value?
I know that when calibrated, the photoswitches will shine yellow/orange when over tape, and green when over the carpet.
I just need to know what default value they will return when over both surfaces. The get() method of DigitalInput returns a boolean value, but which condition will return true, and which false. I am guessing that tape returns true, but I really can't test it until the competition since my team does not have access to these materials. Anybody know? Also, first post on these forums! Last edited by microeyes360 : 19-02-2011 at 13:44. |
|
#2
|
||||
|
||||
|
Re: Photoswitch value?
Congratulations on your first post!
What the sensors return depends on how they are wired. Ours originally returned true when over the carpet (green) and false when over the tape (yellow), but now it's the other way around. Write your code so it's easy to change, and test at competitions. |
|
#3
|
|||
|
|||
|
Re: Photoswitch value?
A Photoswitch Has 2 Values
On and Off Or 0/1 This can be translated into binary and using a bitmask we can get values either know as Opcodes to translate into robot movement. byte mask = 0; if(sensor0 is active) mask |= 0x1; if(sensor1 is active) mask |= 0x2; if(sensor2 is active) mask |= 0x4; return mask; MIN OPCODE = 0, MAX OPCODE = 7 [2^0 + 2^1 + 2^2] |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|