Loading ...
Sorry, an error occurred while loading the content.

Problem Interfacing AirCable and Intellibrain

Expand Messages
  • sazzda
    Hi, I have been trying to interface the Aircable with the Intellibrain. For this I tried to send Move from the aircable to the intellibrain and make the
    Message 1 of 1 , Jul 7, 2007
    • 0 Attachment
      Hi,

      I have been trying to interface the Aircable with the Intellibrain.
      For this I tried to send "Move" from the aircable to the intellibrain
      and make the robot move. The code I have been using is given below.

      public class Move {
      public static void main(String args[]) {
      while(true){
      try {

      SerialPort comPort = IntelliBrain.getCom1();
      comPort.setSerialPortParams(9600,
      SerialPort.DATABITS_8,
      SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
      InputStream inputStream = comPort.getInputStream();
      OutputStream outputStream = comPort.getOutputStream();

      byte[] data1=new byte[5];
      int data=0;

      Servo leftServo=IntelliBrain.getServo(1);
      Servo rightServo=IntelliBrain.getServo(2);

      data=inputStream.read(data1);
      String input=new String(data1);

      if (data1[0]=='M'){

      leftServo.setPosition(100);
      rightServo.setPosition(0);
      Thread.sleep(500);
      leftServo.off();
      rightServo.off();
      }
      else
      {
      //System.out.println("Data not found");
      }
      }
      catch(Exception e)
      {
      }
      }
      }
      }

      It is not that this code does not work. It works, but only when I
      restart the aircable for several times while running the intellibrain
      program all the time. I don't know what is wrong with the program. It
      would be very grateful if any one could help.

      thankyou
      shraddha
    Your message has been successfully submitted and would be delivered to recipients shortly.