E
E
Elnur Tazhimbetov2020-09-21 18:13:01
Python
Elnur Tazhimbetov, 2020-09-21 18:13:01

How to run your functions when receiving a signal from a comport in python?

Pseudocode:

connectionToPort = createConnection(COM3, 9600)
connectionToPort.setHandler(callbackFunction)

callbackFunction(data){
   if(data==SIGNAL_START){
      doSomethingOnStart()
   }else if(data == SIGNAL_ANOTHER){
         doSomethingOnAnother()
   }else{
       doSomethingOnUnKnown()
   }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question