diff options
| author | Ido Hadanny <ido.hadanny@gmail.com> | 2011-09-22 23:25:10 +0300 |
|---|---|---|
| committer | Ido Hadanny <ido.hadanny@gmail.com> | 2011-09-22 23:25:10 +0300 |
| commit | e1c7d9f61bbdf2984c85c4704653428d1cf11d0a (patch) | |
| tree | 7fb29ae667b842ab028a245fd401c823c31465e9 | |
| parent | 24669379c122f03aeb200ab79441bd2adc7186bd (diff) | |
very first attempt to mimic UI
| -rw-r--r-- | roombacomm-client/src/com/hackingroomba/roombacomm/IdoTest1.java | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/roombacomm-client/src/com/hackingroomba/roombacomm/IdoTest1.java b/roombacomm-client/src/com/hackingroomba/roombacomm/IdoTest1.java index 960e206..0bb2d26 100644 --- a/roombacomm-client/src/com/hackingroomba/roombacomm/IdoTest1.java +++ b/roombacomm-client/src/com/hackingroomba/roombacomm/IdoTest1.java @@ -4,23 +4,32 @@ public class IdoTest1 { /** * @param args + * @throws Exception */ - public static void main(String[] args) { + public static void main(String[] args) throws Exception { RoombaCommSerial roomba = new RoombaCommSerial(); String[] ports = roomba.listPorts(); // if implemented + roomba.setProtocol("OI"); roomba.connect("/dev/ttyUSB0"); roomba.startup(); - roomba.control(); - roomba.updateSensors(); - { - roomba.sensors(); - - roomba.playNote( 53, 12 ); - roomba.goForward( 400 ); - roomba.spinRight( 45 ); - if( roomba.bump() ) roomba.goBackward( 100 ); - } + //roomba.control(); +// roomba.send(new byte[] {(byte) 136, (byte) 9}); +// Thread.sleep((long)15); +// roomba.send(new byte[] {(byte) 141, (byte) 1}); + //roomba.send(9); + //roomba.max(); + //roomba.send(new int[] {( 136, 0}); + // + byte cmd[] = { (byte)roomba.SENSORS, (byte)0}; + boolean success = roomba.send(cmd); + String s = roomba.getSensorsAsString(); + System.out.println(s); + //boolean success = roomba.updateSensors(); + //roomba.send(new byte[] {(byte)148, (byte)1, (byte)2}); + //roomba.getSensorData(4); + //roomba.sensors(2); + roomba.send(new byte[] {(byte) 136, (byte) 255}); roomba.disconnect(); } |
