Shop OBEX P1 Docs P2 Docs Learn Events
Capture RC receiver input with pulsin — Parallax Forums

Capture RC receiver input with pulsin

BritannicusBritannicus Posts: 98
edited 2010-11-25 14:08 in BASIC Stamp
OK,

I know I'm being increadibly dumb here - I'm trying to capture the pulse from an RC receiver on my basic stamp2 - I've rigged the output and coupled the signal wire to port 1, via 470ohm reistor by way of protection.

I've written a very short code just to display (I had hoped) the value of the pulse in - have I wired this wrong ?? I've not wired the other two wires from the receiver figuring all these do is supply power to the servo.

I'm obviously wrong in either my code or my wiring - does anyone have a good example of both I can look at of a simple RC input being captured and displaying the variable value ?? all I get is a stream of ones.

code is like this

' {$STAMP BS2}
' {$PBASIC 2.5}

SIG1 VAR Word ' SETS THE VARIABLE SIG1
PULSIN 1,0,SIG1

MAIN:

DO
DEBUG CR, "I'VE GOT A VALUE of "
DEBUG ? SIG1

PAUSE 260

LOOP

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-11-25 12:14
    Make sure the ground (negative power supply lead) on the RC receiver is connected to the ground on the Stamp.

    You didn't mention what happens when you try your setup, just that something's happening that you're not happy about. It's important to give enough information when you have a problem. You need to show or describe your entire setup and what happens or doesn't happen when you try something.
  • stamptrolstamptrol Posts: 1,731
    edited 2010-11-25 12:21
    Also, I think your code only checks once for the pulse, then loops continuously in the debug statements.
  • BritannicusBritannicus Posts: 98
    edited 2010-11-25 14:08
    stamptrol wrote: »
    Also, I think your code only checks once for the pulse, then loops continuously in the debug statements.


    Your're both quite right I should have mentioned that I'd connected this to a BOE.

    I'm a real novice here, so bear with me please ! Tom's pointed out my real dummy mistake - I'll try that and I'll post again if I'm still struggling

    thanks guys
Sign In or Register to comment.