With a classical Arduino Mega board I would have use digital inputs pins like for example 8 to 11 for RX and 35 – 41 for TX and use the following code to get my distance value:
#include <SoftwareSerial.h> #include <SPI.h> //Sensor SoftwareSerial A (8, 35); // RX, TX SoftwareSerial B (9, 37); // RX, TX SoftwareSerial C (10, 39); // RX, TX
SoftwareSerial D (11, 41); // RX, TX
For HMI wiring I also need RX and TX.
My issue is that Digital outputs with Arduino can’t be used as Input and I still need 10 inputs to be connected (8 for Ultrasonic & 2 for HMI)
I am wondering if I can use the remaining A12 to A15 / Input 16-17-18 / IN0 & IN1 / RS485 B & A to connect the 4 ultrasonic sensors and the HMI ?
Regarding the motorized valve, I need to invert the DC current to open it or close it. I can do it using 4 relais and create a H bridge but I was wondering if there is a simplest way to invert polarity using Controllino Mega.