Close

Design challenge n.9: Arduino IDE Software functions

A project log for Green BMS

Open source Bluetooth Smart Battery Management System

Sergio GhirardelliSergio Ghirardelli 10/19/2021 at 10:070 Comments

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:

  1. 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