Menu Interface: Pin State Monitor
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 digitalRead 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 digitalRead 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.
Example (Debugging and Checking Digital Sensors)
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 see status of IR sensor on Pin State Monitor.
Example (Debugging and Calibrating Analog Sensors)
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! 😉
Introduction You must have played Air Hockey! Pay few $$dollars$$ to the gaming zone and just start scoring goals to beat your friends. Isn’t it