User Tools

Site Tools


roborio_digital_io

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
roborio_digital_io [2018/01/28 15:01] – [Selecting from among more than two alternatives] tellroborio_digital_io [2018/12/11 22:31] (current) – [Selecting from among more than two alternatives] tell
Line 98: Line 98:
  
  
- 
-====== Selecting from among more than two alternatives ====== 
- 
-One DIO input can tell the software to do one out of two possible alternatives.  What if we want to select from between more than two?  Use more DIO inputs! 
- 
-We could use two DIOs for two different limit switches: one for UP, one for DOWN, and if neither switch is closed, we interpret that to mean the mechanism is somewhere in between. 
- 
-Suppose we want to select from four different autonomous routines.  we could use two switches, and tell the drive team to set them according to a table like this: 
- 
-  * 0: Closed, Closed - do nothing 
-  * 1: Closed, Open   - drive forward 
-  * 2: Open, Closed   - drive forward and place power cube 
-  * 3: Closed, Closed - drive forward, turn left, drive, turn right, drive, and then place cube 
- 
-[picture]? 
- 
-But requiring the drivers to read the chart, even if it is written on the robot, is error prone. 
-A better **user interface** would be a rotary switch. 
- 
-[picture] 
- 
-A typical rotary switch contains one or more "levels" each with a moving contact that can connect to one fixed contact at a time.  We typically draw the schematic for such a switch like this: 
- 
-{{ :rotary-switch.png?nolink |}} 
- 
-We can connect a two-level rotary switch like this to encode those four positions into the four possible values for two DIO inputs: 
- 
-{{ :rotary-binary2.png?nolink |}} 
  
  
 +What if we want to select between more than two choices?   See "fun with switches" on the page [[Switches as Digital IO]]
  
 ====== Conclusion ====== ====== Conclusion ======
roborio_digital_io.1517169683.txt.gz · Last modified: 2018/01/28 15:01 by tell