File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ """
3
+ This is a demo program showing the use of GenericHID's rumble feature.
4
+ """
5
+
6
+ import wpilib
7
+
8
+
9
+ class MyRobot (wpilib .TimedRobot ):
10
+
11
+ def robotInit (self ):
12
+ """Robot initialization function"""
13
+
14
+ self .hid = wpilib .XboxController (0 )
15
+
16
+ def autonomousInit (self ):
17
+ # Turn on rumble at the start of auto
18
+ self .hid .setRumble (wpilib .XboxController .RumbleType .kLeftRumble , 1.0 )
19
+ self .hid .setRumble (wpilib .XboxController .RumbleType .kRightRumble , 1.0 )
20
+
21
+ def disabledInit (self ):
22
+ # Stop the rumble when entering disabled
23
+ self .hid .setRumble (wpilib .XboxController .RumbleType .kLeftRumble , 0.0 )
24
+ self .hid .setRumble (wpilib .XboxController .RumbleType .kRightRumble , 0.0 )
25
+
26
+
27
+ if __name__ == "__main__" :
28
+ wpilib .run (MyRobot )
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ BASE_TESTS="
26
26
getting-started
27
27
gyro
28
28
gyro-mecanum
29
+ hid-rumble
29
30
i2c-communication
30
31
magicbot-simple
31
32
mecanum-drive
You can’t perform that action at this time.
0 commit comments