Shop OBEX P1 Docs P2 Docs Learn Events
Using Devantech SF02 in Parallax Javelin — Parallax Forums

Using Devantech SF02 in Parallax Javelin

onlyroonlyro Posts: 2
edited 2007-12-25 17:44 in General Discussion
Hi,
I am trying to use Devantech SRF02 in my robot loaded with Parallax Javelin.
My teammate found that there is a class called SRF04.java which can be used in order to conveniently communicate between the Javelin and Devantech SRF04, but could not find any corresponding class for SRF02.
Is it possible to modify SRF04.java class or somehow in order to make them compatible?
If so, could any of the experts tell us how to do so?
Thank you.

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-12-22 03:49
    The SRF02 datasheet:
    http://www.robot-italy.com/download/srf02_serial.pdf

    shows that you need to setup a serial connection.

    static final int pinTX = CPU.pin0;
    static final int pinRX = CPU.pin1;
    static Uart srfTX = new Uart(Uart.dirTransmit,pinTX,Uart.dontInvert,Uart.speed9600,Uart.stop2);
    static Uart srfRX = new Uart(Uart.dirReceive,pinRX,Uart.dontInvert,Uart.speed9600,Uart.stop2);

    Then you send commands using srfTX. Each command is two bytes.
    The response is received on the rx pin and can be retrieved using sfrRX.

    regards peter
  • onlyroonlyro Posts: 2
    edited 2007-12-23 03:11
    thank you so much!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-12-25 17:44
    This thread is being moved from the Stamps In Class Forum to the Javelin Forum.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.