When I am using XOR gate to generate the pulse and the output of XOR gate is connected to Pin 13, it just prints zero. The output of XOR gate is shown as attachment.
#include <LiquidCrystal.h>
int pin = 13;
float rads = 57.29577951;
float degree = 360;
float frequency = 50;
float nano = 1 * pow (10,-6);
float angle;
int ctr;
void setup()
{
pinMode(pin, INPUT);
Serial.begin(9600);
lcd.begin(16, 2);
}
void loop()
{
for (ctr = 0; ctr <= 4; ctr++) // Perform 4 measurements then reset
{
angle = ((((pulseIn(pin, HIGH)) * nano)* degree)* frequency);
Pulse_value = pulseIn(pin,HIGH);
Serial.print(Pulse_value, 2);
Serial.print("//");
}
Output:
0.00//0.00//0.00//0.00//0.00//0.00

