Pages: [1]   Go Down
Author Topic: Pulsein function, getting inaccurate data  (Read 224 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi guys,

I used the below code (part of the program) and try to obtain rc signal from my RC receiver.

Code:
 
if(sensor_update == true && ((timeNow-timer)>=20))
  {
      ch1 = pulseIn(5,HIGH,20000);
      Serial.println(ch1);
      sensor_update = false;
     
  }

the joy stick of the transmitter is static but I got my output as follow

Code:
1132
1132
1
1132
1132
1
1126
1132
614
1132
1
1
1126
1132
1
1132
1
1132
131
1
1132
965
1132
1132
1132
1132
831
1132
1
5
1132
1126
1
1

Can anyone explain to me why is this happening, and how can I solve this?
thanks a lot!

Jack
Logged

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 108
Posts: 4025
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How is the joystick connected to the Arduino ?
Seeing your whole code would also be helpful
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Pages: [1]   Go Up
Jump to: