From 5b486764a4761bad6cc03b2d356702f3ae078f30 Mon Sep 17 00:00:00 2001 From: Lucien Morey Date: Tue, 21 Nov 2023 08:19:38 +1100 Subject: [PATCH] add code to run shassis leds --- wsce_display_bot.ino | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/wsce_display_bot.ino b/wsce_display_bot.ino index ce17da2..a986978 100644 --- a/wsce_display_bot.ino +++ b/wsce_display_bot.ino @@ -3,6 +3,7 @@ #include "pitcher.hpp" #include "shooter.hpp" #include "robot_defs.hpp" +#include "leds.hpp" typedef enum { @@ -15,9 +16,10 @@ Servo shooter_flywheel; Servo intake_motor; Servo pitcher_motor; -Intake *intake; //{intake_motor}; -Shooter *shooter; //{shooter_flywheel}; -Pitcher *pitcher; //{pitcher_motor}; +Intake *intake; //{intake_motor}; +Shooter *shooter; //{shooter_flywheel}; +Pitcher *pitcher; //{pitcher_motor}; +AddressableLeds *leds; unsigned long last_state_transition_time; unsigned long last_tick_time; @@ -30,6 +32,7 @@ void intake_callback() pitcher->lower(); intake->spin(); + leds->send_forward(); } void shooter_callback() @@ -38,6 +41,7 @@ void shooter_callback() intake->stop(); shooter->shoot(); + leds->send_backward(); } void pitcher_callback() @@ -46,6 +50,7 @@ void pitcher_callback() shooter->stop(); pitcher->raise(); + leds->stop(); } void setup() @@ -58,6 +63,8 @@ void setup() intake = new Intake(intake_motor); shooter = new Shooter(shooter_flywheel); pitcher = new Pitcher(pitcher_motor); + leds = new AddressableLeds(CHASSIS_LEDS_PIN, CHASSIS_LEDS_LENGTH); + leds->set_frequency(5.0); } void loop() @@ -109,6 +116,7 @@ void loop() intake->tick(); shooter->tick(); pitcher->tick(); + leds->tick(); last_tick_time = millis(); }