Skip to content

Commit

Permalink
🎨 (spikes): Update lk_led_kit
Browse files Browse the repository at this point in the history
  • Loading branch information
HPezz committed Mar 4, 2022
1 parent 5278d2e commit ed18b13
Showing 1 changed file with 7 additions and 23 deletions.
30 changes: 7 additions & 23 deletions spikes/lk_led_kit/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "HelloWorld.h"
#include "LedKit.h"
#include "LogKit.h"
#include "Sleeping.h"

using namespace leka;
using namespace std::chrono;
Expand All @@ -26,27 +27,10 @@ auto animation_thread = rtos::Thread {};
auto animation_event_queue = events::EventQueue {};

auto ledkit = LedKit {animation_thread, animation_event_queue, ears, belt};

auto colors_available = std::to_array({
RGB::pure_green,
RGB::pure_red,
RGB::pure_blue,
RGB::yellow,
RGB::cyan,
RGB::magenta,
});
led::animation::Sleeping animation_sleeping(ears, belt);

HelloWorld hello;

RGB sick1 = RGB {30, 255, 0};
RGB sick2 = RGB {94, 104, 1};
RGB singing_green = RGB {29, 168, 0};
RGB singing_red = RGB {255, 65, 61};
RGB singing_yellow = RGB {255, 217, 61};
RGB singing_blue = RGB {21, 125, 230};

RGB red_angry = RGB {255, 98, 98};

auto main() -> int
{
logger::init();
Expand All @@ -55,13 +39,13 @@ auto main() -> int

auto start = rtos::Kernel::Clock::now();

rtos::ThisThread::sleep_for(2s);

hello.start();

while (true) {
auto t = rtos::Kernel::Clock::now() - start;
log_info("A message from your board %s --> \"%s\" at %i s\n", MBED_CONF_APP_TARGET_NAME, hello.world,
int(t.count() / 1000));
ledkit.start(animation_sleeping);
rtos::ThisThread::sleep_for(40s);

ledkit.stop();
rtos::ThisThread::sleep_for(1s);
}
}

0 comments on commit ed18b13

Please sign in to comment.