File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+
3
+ import wpilib
4
+
5
+
6
+ class MyRobot (wpilib .TimedRobot ):
7
+
8
+ def robotInit (self ):
9
+ """Robot initialization function"""
10
+
11
+ self .dutyCycle = wpilib .DutyCycle (wpilib .DigitalInput (0 ))
12
+
13
+ def robotPeriodic (self ):
14
+ # Duty Cycle Frequency in Hz
15
+ frequency = self .dutyCycle .getFrequency ()
16
+
17
+ # Output of duty cycle, ranging from 0 to 1
18
+ # 1 is fully on, 0 is fully off
19
+ output = self .dutyCycle .getOutput ()
20
+
21
+ wpilib .SmartDashboard .putNumber ("Frequency" , frequency )
22
+ wpilib .SmartDashboard .putNumber ("Duty Cycle" , output )
23
+
24
+
25
+ if __name__ == "__main__" :
26
+ wpilib .run (MyRobot )
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ BASE_TESTS="
16
16
differential-drive-bot
17
17
digital-communication
18
18
dutycycle-encoder
19
+ dutycycle-input
19
20
elevator-profiled-pid
20
21
elevator-simulation
21
22
elevator-trapezoid-profile
You can’t perform that action at this time.
0 commit comments