-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Finished LED code v1 Co-authored-by: Harry C <[email protected]> * Formatting fixes --------- Co-authored-by: Harry C <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
6ab3a53
commit a08258f
Showing
8 changed files
with
100 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) 2023-2024 CurtinFRC | ||
// Open Source Software, you can modify it according to the terms | ||
// of the MIT License at the root of this project | ||
|
||
#include "LED.h" | ||
|
||
LED::LED() {} | ||
|
||
void LED::OnUpdate(units::second_t dt) { | ||
switch (_state) { | ||
case LEDState::kIdle: { | ||
_led.frc::PWM::SetSpeed(0); | ||
} break; | ||
|
||
case LEDState::kAiming: { | ||
_led.frc::PWM::SetSpeed(0.27); | ||
} break; | ||
case LEDState::kAmpReady: { | ||
_led.frc::PWM::SetSpeed(0.87); | ||
} break; | ||
case LEDState::kHold: { | ||
_led.frc::PWM::SetSpeed(0.57); | ||
} break; | ||
case LEDState::kIntaking: { | ||
_led.frc::PWM::SetSpeed(0.07); | ||
} break; | ||
case LEDState::kShooterReady: { | ||
_led.frc::PWM::SetSpeed(0.77); | ||
} break; | ||
|
||
default: | ||
break; | ||
} | ||
} | ||
|
||
void LED::SetState(LEDState state) { | ||
_state = state; | ||
} | ||
|
||
LEDState LED::GetState() { | ||
return _state; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) 2023-2024 CurtinFRC | ||
// Open Source Software, you can modify it according to the terms | ||
// of the MIT License at the root of this project | ||
|
||
#pragma once | ||
|
||
#include <frc/PWM.h> | ||
|
||
#include "Wombat.h" | ||
|
||
enum class LEDState { kIntaking, kHold, kAiming, kShooterReady, kAmpReady, kIdle }; | ||
|
||
class LED : public behaviour::HasBehaviour { | ||
public: | ||
LED(); | ||
|
||
void OnUpdate(units::second_t dt); | ||
|
||
void SetState(LEDState state); | ||
LEDState GetState(); | ||
|
||
private: | ||
LEDState _state = LEDState::kIdle; | ||
|
||
frc::PWM _led{0}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters