Notifications
Clear all

this way I don't need to bother much with the Arduino codes

2 Posts
2 Users
0 Reactions
68 Views
mr.meeseeks
(@mr-meeseeks)
Livingrimoire coder
Joined: 1 year ago
Posts: 21
Topic starter  
#include "LivinGrimoireLight.h"

Chobit* c1 = new Chobit(); // global var
void setup() {
    Led led1(6); // used to initialize the Hello World skill
    Skill* s2 = new DiHelloWorld(led1); // example skill created
    Skill* s3 = new DiTemperature(0); // LM35 connected to analog pin #0
    c1->addSkill(s2);
    c1->addSkill(s3);
}

void loop() {
  c1->think(0, 0, 0);
}

^ example of 2 skills added and used. a led blink skill and a temperature read skill.

note the void method only has 1 line of code now

this way the Arduino/Elegoo skills are capsulated.
less code in the void method.
I can swap skills instead of tinker with code
avoid code debt.
can collaborate using skills other people made

 

as Terry A Davis said: "I want my code to be beautiful not just functional"

Team Fuki


   
Quote
(@aliarifat)
Member
Joined: 1 month ago
Posts: 28
 

Add checks or error handling if skills fail to initialize or execute.


   
ReplyQuote