forked from AlexisPelaez/AlexisP_FRC_LED_project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRobot.java
More file actions
113 lines (95 loc) · 2.98 KB
/
Copy pathRobot.java
File metadata and controls
113 lines (95 loc) · 2.98 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc.robot;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.LEDPattern.GradientType;
import edu.wpi.first.wpilibj.PowerDistribution.ModuleType;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.util.Color;
import static edu.wpi.first.units.Units.Meters;
import static edu.wpi.first.units.Units.MetersPerSecond;
import static edu.wpi.first.units.Units.Percent;
import java.util.Random;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.units.measure.Distance;
import edu.wpi.first.units.measure.Power;
import edu.wpi.first.wpilibj.AddressableLED;
import edu.wpi.first.wpilibj.AddressableLEDBuffer;
import edu.wpi.first.wpilibj.AddressableLEDBufferView;
import edu.wpi.first.wpilibj.LEDPattern;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj.PowerDistribution;
/**
* The methods in this class are called automatically corresponding to each mode, as described in
* the TimedRobot documentation. If you change the name of this class or the package after creating
* this project, you must also update the Main.java file in the project.
*/
public class Robot extends TimedRobot {
/**
* This function is run when the robot is first started up and should be used for any
* initialization code.
*/
LEDSubsystem led;
XboxController control = new XboxController(0) ;
public Robot() {
}
@Override
public void robotInit() {
led = new LEDSubsystem(9); // PUT LED PWMPORT HERE
led.setInfo();
led.startFastUpdates();
}
@Override
public void robotPeriodic() {
//led.setInfo(); commented as it made it crash out and fly
led.voltageChecker();
}
@Override
public void autonomousPeriodic() {}
@Override
public void teleopInit() {
}
@Override
public void teleopPeriodic() {
if(control.getStartButtonPressed()){
led.Overclock(true); // OVERCLOCK
}
if(control.getAButton()){
led.fill(0, 0, 10);
}
if(control.getBButton()){
led.clear();
led.Overclock(false);
}
if(control.getXButton()){
led.sparkle();
}
if(control.getYButton()){
led.fillRow(0, 1, 10, 10, 10);
led.fillRow(0, 8, 10, 10, 10);
led.fillRow(0, 4, 10, 10, 10);
led.fillRow(0, 5, 10, 10, 10);
led.fillRow(0, 2, 0, 0, 10);
led.fillRow(0, 3, 0, 0, 10);
led.fillRow(0, 2, 0, 0, 10);
led.fillRow(0, 3, 0, 0, 10);
led.fillRow(0, 6, 0, 0, 10);
led.fillRow(0, 7, 0, 0, 10);
}
}
@Override
public void disabledInit() {
}
@Override
public void disabledPeriodic() {}
@Override
public void testInit() {}
@Override
public void testPeriodic() {}
@Override
public void simulationInit() {}
@Override
public void simulationPeriodic() {}
}