Pin State monitor is included in the evive menu. It shows the state of all the digital and analog pins on evive. It shows output as high or low for digital pins and analog value for analog pins. The pins are displayed in tabular form on the evive screen.
There are 40 digital pins in evive and 16 analog pins. Different colours are used to show the pin no. and its’ respective output.
There is a function named digitalRead in library screenimplementation.h in evive. It reads the state of digital pins in evive. In digital pins, there are 15 PWM pins whose state is determined first by a function called turnOffPWM in ligitalRead which turns off PWM before reading pin. After this, it reads the pin and returns high if pin output is high and low if pin output is low. turnOffPWM uses standard(AVR) methods for setting, or clearing, bits in PORT.
Then the lcd_digital_pin_state_monitor_late() function prints all this on the screen. It uses for loop to set lcdCursor and print all the pins. Similarly, analog pins are also printed. The ligitalRead returns high when the if condition *portInputRegister(port) & bit is true. portInputRegister returns an input port register of the specified port. bit = digitalPinToBitMask(pin) which returns the bit mask of a specified pin.
Suppose, you have a IR sensor to detect a ball passing through a tube. Most of the sensors has an adjustment screws/potentiometer or you need to adjust the distance where the sensor is mounted from the ball. You can connect the sensor output to any Pin on evive and Pin State Monitor will display the change in readings.
Suppose, we want to find a cutoff or maximum and minimum reading of an analog sensor like a Joystick or Flex sensor. We can move the thumbstick and take the readings from the Analog State Monitor. No need to make such program, evive is there for you! 😉