Shop OBEX P1 Docs P2 Docs Learn Events
Javelin with CMUcam1 — Parallax Forums

Javelin with CMUcam1

YojimboYojimbo Posts: 40
edited 2005-08-09 01:14 in General Discussion
Hey all, I am trying to get my CMUcam1 (on my boebot) to communicate to my laptop running CMUcamGUI. Basically, I am trying to write a program that will catch data from the computer and send it to the camera, and then catch the cameras response, and send it back to the laptop. I think I need to use 2 UART objects, but I've having diffuculty. Anyone have any insight? It would be much appreciated. Thanks!

Comments

  • YojimboYojimbo Posts: 40
    edited 2005-08-07 22:50
    ok, so I've been playing with this for a little while but I am having little luck. Bellow is some code I've been messing with to try and get at least some communication between the CMUcamGUI java program and the CMUcam1 on the BOEBot. The camera doesn't seem to be acknowledging any of the commands, though I am use its going to the right pins and at the right baudrate. Any insight would really really help. Thanks!!

    import stamp.core.*;
    import java.lang.*;

    public class TestCam {

    static Uart txUartCam = new Uart(Uart.dirTransmit,CPU.pin11,Uart.dontInvert,Uart.speed9600,Uart.stop1); //pin 11 is marked pin 7 on the board of education

    static Uart rxUartCam = new Uart(Uart.dirReceive,CPU.pin13,Uart.dontInvert,Uart.speed9600,Uart.stop1); //pin 13 is marked pin 9, the camera has no handshaking pins, just rx and tx

    static String firstTest = "RS \r";
    static String CR = "\r";
    static String secondTest = "L1 1\r";
    static StringBuffer buffer = new StringBuffer(128);
    static char c;

    public static void main(){
    System.out.println(firstTest);
    System.out.println(secondTest);
    //c = 0xff;
    txUartCam.sendString("RS \r"); //I tried using firstTest here but got the same results, nothing
    while(rxUartCam.byteAvailable()){
    c = (char)rxUartCam.receiveByte();
    if (c != '.'){ //added this little filter because looking at the data stream, I saw a lot of periods
    buffer.append(c);
    System.out.println(c); //this is so I can see if anything is getting received in realtime
    }
    }
    System.out.println(buffer.toString()); //this should throw out the response from the camera but I get nothing

    CPU.nap(7);
    txUartCam.sendString("L1 1\r"); //this should turn on the green tracking LED on the camera but no go.
    while(rxUartCam.byteAvailable()){
    c = (char)rxUartCam.receiveByte();
    if (c != '.'){
    buffer.append(c);
    System.out.println(c);
    }
    }
    System.out.println(buffer.toString());
    }



    }

    Post Edited (Yojimbo) : 8/7/2005 11:13:13 PM GMT
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-08-08 05:11
    According to the basic stamp 2 test program,

    the reset command is "RS",CR not "RS ",CR as in your code.

    Possibly the CMUCAM gets upset by this.

    So try firstTest = "RS\r"

    regards peter
  • YojimboYojimbo Posts: 40
    edited 2005-08-09 01:14
    yea, I noted this earlier, the space I put in there after I tried simply "RS" because there was a space in the pamphlet, but it seemed to have no effect. [noparse]:([/noparse] good catch though!
Sign In or Register to comment.