Every software designer has their own way of programming, there is no single method.
My job is PLC (Programmable Logic Controller) programmer and therefore I developed my project on Arduino IDE using the methods and functions that I normally use in Ladder language.
First, I avoided using interrupts and the "delay" command: I made sure that the task always ran as smoothly as possible.
So where it was necessary to use timings, I did it via the "Millis ()" function, here is an example:

I have also created 2 typical PLC functions that are very important to me:
- TON = timer on

The function I created to use the TON is this:

2. Positive and negative edges

The functions to use edges are this:

These functions, added to others that I have created, have allowed me to develop Attiny and Mega sketches as I like!!!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.