Go to Post ...the list of the things we want to get done in the off-season has grown to such a length that I have to take off my shoes and socks to count them...and I think I may need to grow a few more toes soon. - StephLee [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 20-02-2011, 15:31
Hadyn Fitzgeral Hadyn Fitzgeral is offline
Registered User
None #1234
 
Join Date: Feb 2011
Rookie Year: 2013
Location: No where
Posts: 3
Hadyn Fitzgeral is an unknown quantity at this point
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]
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:25.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi