-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVexJoystick.cpp
More file actions
38 lines (30 loc) · 814 Bytes
/
VexJoystick.cpp
File metadata and controls
38 lines (30 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// VexJoystick.cpp
// PartnerPort
//
// Created by Matthew Dyer on 2/03/15.
//
#include "VexJoystick.h"
VexJoystick::VexJoystick(){
for (int i=0;i<NUM_BUTTONS;i++){
this->buttons[i] = false;
}
for (int i=0;i<NUM_ANALOG_CHANNELS;i++){
this->analogChannels[i] = 127; //127 is 0, maybe change this to be -128 to 127 like in robotC?
}
}
void VexJoystick::setChannel(AnalogChannels channel,char value){
analogChannels[channel] = value;
}
void VexJoystick::setChannel(AnalogChannels channel,int value){
this->setChannel(channel,(char)value);
}
void VexJoystick::setChannel(Buttons b,bool value){
buttons[b] = value;
}
unsigned char* VexJoystick::getAnalogChannels(){
return this->analogChannels;
}
bool* VexJoystick::getButtons(){
return this->buttons;
}