Showcasing an alternative way to code

I will show you 2 coding walkthroughs, both do the same thing: they send a byte to an Arduino from the laptop/Raspberri Pi

here is the Arduino code (the same in both cases):

int ledPin = 13;
 
void setup() {
  Serial.begin(9600);
  pinMode(ledPin,OUTPUT);
  digitalWrite(ledPin,LOW);
}
 
void loop() { 
    if (Serial.read() == 'T'){
      digitalWrite(ledPin,HIGH);}
}

it's a hello world. all it does is light up the default built in led (pin 13).

here is the way most NPCs code it(python code):

ser = serial.Serial("COM4", 9600,timeout=1.0)
 time.sleep(3)
 ser.reset_input_buffer()
 ser.write(b'T')
 print("ok")
 time.sleep(2)
 ser.close()

they also need to add the import statement:

import serial

here is my suggested alternative way:

    neo:Chobits = Chobits()
    neo.addSkill(DiArduino1())
    neo.think("sr T", "", "")
    time.sleep(2)
    neo.think("close serial", "", "")

in my way all I need to add to get the laptop to Arduino communication ability is 1 line of code:

neo.addSkill(DiArduino1())
I can send any char via the ear param: "sr V" or "sr T" for example

I need not concern myself with the logic or the hardware code.

the skill also has a close serial capability.

I can easily transfer this ability to other projects. I can add multiple abilities,.
I can add other abilities

to engage with this ability, thus encapsulating the logic separately.

all it took was 1 line of code.

some of you may see it is the same principle as the matrix learn scene. or even the anime edgerunners.

what do you think?

I moved your topic to an appropriate forum category @mister_meeseeks.

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Interesting.

Are you selling or promoting something? Where does beo come from, and where do we get Chopbits?

How does the second program know to talk to COM4?

a7

Where does beo come from, and where do we get Chopbits ?

all I did was add the files:
LivinGrimoireCoreV2.py and AXPython.py to my project:

How does the second program know to talk to COM4?

next in a skills file I had a skill class with the serial ability:

class DiArduino1(DiSkillV2):
    def __init__(self):
        self._cmdBreaker: AXCmdBreaker = AXCmdBreaker("sr")
        self._ser = serial.Serial("COM4", 9600, timeout=1.0)
        time.sleep(3)
        super().__init__()

    def setCommandPrefix(self,cmd_prefix):
        self._cmdBreaker.conjuration = cmd_prefix

    # Override
    def input(self, ear: str, skin: str, eye: str):
        if ear == "close serial":
            self._ser.close()
        n: str = self._cmdBreaker.extractCmdParam(ear)
        if not n == "":
            self._ser.reset_input_buffer()
            n2: bytes = n.encode('ASCII')
            self._ser.write(n2)
            print("serial port closed")

also:
run in command line:
pip3 install pyserial
than restart pycharm

Are you selling or promoting something?
well, I want to solve the fudge out of the brain algorithm, and if
people adopt this lazy way of coding, and make their own skills
we can be lazier together.

instead of studying documentations we could simply choose skills and add them to a Chobits or brain object.

you can sell your skills as well.
I for one would rather pay a few bucks for a ready skill rather than study the code that does it. that's me, I'm not speaking for others.

I'd like to understand others better.

there are two books if you want to take a look :
public-livinGrimoire/livingrimoire start here at master · yotamarker/public-livinGrimoire (github.com)

and a wiki:

my post got auto deleted.
but I simply used the livingrimoire.

No, it does not seem like you are.

I am far too lazy to use your alternate approach.

a7

I'm glad you said that.
it makes you the perfect person to say why?

You lost me at stereotyping.