Power on directly after boot?

Hello I have a small question sadly didn’t found anything in the search

Is it possible to ignite the sword directly after boot without buttons?
I would like to wall mount the saber with an external power source wich is trigger via a photocell sensor

And then power off after a specific time frame

Is this possible ?

Short answer: yes

There are several ways to do this.
Probably the best would be to put a “script” in your config file, that would look something like:

struct Script : Looper, StateMachine {
  const char* name() override { return "script"; }
  void Loop() override {
     CommandParser::DoParse("on", nullptr);
     SLEEP(2 * 60 * 1000); // 2 minutes
     CommandParser::DoParse("off", nullptr);
Script script;
1 Like

Thank you
I will try it out never thought about a script
So I don’t have to mess with the core scripts itself

If I could post 5 likes, I would.