I am using the basic read example and Im getting zeros...
I chose pin 19 because is an interrupt on Mega. Maybe the syntax changed and the library did not keep up?
#include <PulseInput.h>
volatile unsigned int input; /* each signal requires a variable */
void setup() {
Serial.begin(115200); // Speed must stay at 115200 Not lower or higher to work with the USB shield
// 2. assign variables to receive signal
attachPulseInput(19, input); // pin 8 as INPUT_PULLUP
/* Generate pwm signal */
constexpr int PIN = 3; // PWM capable pin
constexpr int ON_TIME = 1000; // Pulse width in microseconds
constexpr float DUTY_CYCLE = ON_TIME * 255.0 / 2024.0;
analogWrite(PIN, DUTY_CYCLE);
/* To stop reading an already specified input, use this function: */
//detachPulseInput(19); // Stop reading input at pin 8
}
void loop() {
// read signal [microseconds]
Serial.println(input);
}
Then I use pulseIn and I get nice values such as 1455,
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
}
void loop() {
int thro = pulseIn(19, HIGH ); // Thro Port- 1093 to 1885 Triple servo wire
Serial.print("THRO ="); // Print the value of
Serial.println(thro);
}
I moved your topic to an appropriate forum category @laptophead.
In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.