Skip to content

Commit

Permalink
[MAIN] Setup the scheduleRunner for a loop
Browse files Browse the repository at this point in the history
  • Loading branch information
MrVyM committed Nov 29, 2023
1 parent 95e9584 commit ba5a9b5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
pub mod cli;
pub mod mqtt;

use bevy::prelude::*;
use bevy::{app::ScheduleRunnerPlugin, prelude::*};
use clap::Parser;
use cli::{ressources::Args, system::print_arg};
use mqtt::connect_every_broker;
use std::time::Duration;

const FREQUENCY: f64 = 200.0;

fn heartbeat() {
println!("Heartbeat !");
}

fn hello_world() {
println!("Good to see you !");
Expand All @@ -17,5 +24,9 @@ fn main() {
.add_systems(Startup, hello_world)
.add_systems(Startup, print_arg)
.add_systems(Startup, connect_every_broker)
.add_systems(Update, heartbeat)
.add_plugins(ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(
1.0 / FREQUENCY,
)))
.run();
}

0 comments on commit ba5a9b5

Please sign in to comment.