Javelin with CMUcam1
Yojimbo
Posts: 40
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
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
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