Hi, I am using the following code to read PWM from one channel of an RC receiver and trigger the shutter of a camera.
#include <multiCameraIrControl.h>
const int buttonPin=9;
unsigned long buttonState;
Sony NEX5N(2);
void setup(){
pinMode(13,OUTPUT);
pinMode(buttonPin,INPUT);
Serial.begin(9600);
}
void loop(){
buttonState=pulseIn(buttonPin,HIGH);
Serial.println(buttonState);
if(buttonState>2095){
NEX5N.shutterNow();
delay(2000);
digitalWrite(13,LOW);
}
else if(buttonState>1549 && buttonState<1560){
NEX5N.shutterNow();
delay(800);
NEX5N.shutterNow();
delay(800);
NEX5N.shutterNow();
delay(800);
NEX5N.shutterNow();
delay(800);
}
else if(buttonState>997 && buttonState<1005){
NEX5N.toggleVideo();
delay(5000);
}
else{
digitalWrite(13,LOW);
}
}
But looking at the serial monitor, the numbers that appear look rather random rather than following the input from my transmitter, would there be something on the code?
I am directly connecting the signal from receiver to the 9 pin in arduino
Thanks