Go Down

Topic: Controlling with onChange() later() and forget() , an event based system. (Read 384 times) previous topic - next topic

spitstec

I designed a system around a special preprocessor and a timing queue. This enables you to make event base programs that are easy to maintain. With this system you can easily combine many functionalities in one sketch. All timing and waiting is centralized.


Example debounce key. This code toggles the led if a key is pushed but only when the contact lasted for more than 20 ms


Code: [Select]

#include "later.h" 
#include "harvested.h"

#define pushContact 6

onChange(pushContact) {
if (hi)
  later(20,debounced) ;
else
  forget(debounced) ; }

void debounced(void) {
  digtitalWrite(13,!digitalRead(13)) ;}

void setup(void) {
    EvStartMacro 
}


void loop() {
   EvLoopMacro ;
   peek_event() ;
}

more examples on my github page:

https://github.com/spitstec/laterAndForget

Robin2

I had a brief look at your GitHub link.

It seems to me that one would have to learn a completely new language without the benefit of documentation. Sorry.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

spitstec


Robin2

You will have to learn just a few keywords.
It may seem like that to you as you are an expert.

My strong feeling is that a complete beginner will need to put in a lot of learning - even someone who is currently skilled with C++.


Also, it seems to me (but I am often wrong) that something like this would be most attractive to a newbie who does not know programming and has never heard of GitHub. If (like me) the person already knows sufficient C++ I can't see any value to me from the extra learning to use your system. (And I am by no means an expert C++ programmer).

And I reckon a newbie would need something like a 100-page manual (or the equivalent in online tutorials) to teach him/her how to use any system

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up