View Single Post
  #6   Spotlight this post!  
Unread 10-02-2014, 22:01
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Using Keyboard to Drive

The functions used in the Dashboard to read the keyboard are in the Connectivity -> Input Device Control function palette.

Use the Initialize Keyboard function to get a "device ID" output, and pass that into the loop that reads the keyboard using the Acquire Input Data function. The result will be an array of keys being pressed. If the length of the array is zero, no keys are pressed. If you don't want to be able to handle multiple keys pressed at the same time, just use an Index Array function to pick out the first element of the array.

The Smart Dashboard functions used to send data to the robot are in the WPI Robotics Library -> Dashboard function palette.

Use the SD Write String function to put the value of the key being pressed (or a null string if no keys are pressed) into a Smart Dashboard variable.

In the C++ code, use the NetworkTables support to read the value of the variable out of the SmartDashboard table. http://wpilib.screenstepslive.com/s/...client-pc-side gives a lot of information and some example code for using NetworkTables.
Reply With Quote