Shop OBEX P1 Docs P2 Docs Learn Events
Borked PING? — Parallax Forums

Borked PING?

Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
edited 2008-06-02 15:04 in Propeller 1
With my robot building this weekend, I'm finally getting around to a proper test of that PING sensor
I received as a gift from the spouse....

I'm feeding it 5v,Gnd, and SIG to the prop via 1k resistor.

Using Mike's BOE-BOT-BASIC, it looks like I get 1 good reading from it when I reset the Prop.
After that, any continued readings don't flash the ACTivity light, and all report back the same as
the first.

Does the sensor sound shot or is there a way to reset it?

OBC

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?

Getting started with the Protoboard? - Propeller Cookbook 1.4
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card? - PropDOS
Need a part? Got spare electronics? - The Electronics Exchange

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-06-02 05:19
    Read the brief description of the PING command. The interpreter initiates a read from the PING with the PING statement, then reads the most recent returned value with the PING "pseudo-variable" which is zero if nothing has been read yet.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-06-02 14:08
    So how does one read multiple distances?

    BOE-BASIC:

    10 A=PING
    20 PRINT A
    30 PAUSE 200
    40 GOTO 10

    I figure that this would recalculate the distance each time it loops, no?

    I'm getting nothing but backup and re-eval from your sample program.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with the Protoboard? - Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card? - PropDOS
    Need a part? Got spare electronics? - The Electronics Exchange
  • Mike GreenMike Green Posts: 23,101
    edited 2008-06-02 14:34
    Like this

    10 REM Start the PING cycle
    20 PING
    30 REM Now wait for it to finish
    40 A = PING
    50 IF A = 0 THEN GOTO 40
    60 PRINT A
    70 PAUSE 200
    80 GOTO 10
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-06-02 15:04
    That was the ticket!

    Thanks Mike!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with the Protoboard? - Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card? - PropDOS
    Need a part? Got spare electronics? - The Electronics Exchange
Sign In or Register to comment.