From ac5f82ce26d09aea89b9e9acd9fa0f8569240301 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 16 Sep 2011 11:30:19 +0100 Subject: Chnages for touch screen. --- PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java | 4 ++-- PunchingBag/src/uk/ac/open/punchingbag/PunchingBagGUI.java | 9 ++++++--- .../src/uk/ac/open/punchingbag/examples/SimpleKeyboard.java | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java b/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java index 1e710bc..a7d7f0c 100644 --- a/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java +++ b/PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java @@ -107,7 +107,7 @@ public class PunchingBag implements Runnable { * The device address of the button arduino (COM* on Windows, /dev/tty* on * linux) */ - String buttonArduinoDeviceAddress = ""; // TODO: This should be cached + String buttonArduinoDeviceAddress = "COM4"; // TODO: This should be cached // localy /** * The Arduino managing the led drivers @@ -117,7 +117,7 @@ public class PunchingBag implements Runnable { * The device address of the led arduino (COM* on Windows, /dev/tty* on * linux) */ - String ledArduinoDeviceAddress = ""; // TODO: This should be cached localy + String ledArduinoDeviceAddress = "COM3"; // TODO: This should be cached localy /** * Turn on to activate the command line messages regarding the run loop diff --git a/PunchingBag/src/uk/ac/open/punchingbag/PunchingBagGUI.java b/PunchingBag/src/uk/ac/open/punchingbag/PunchingBagGUI.java index d71a6c6..4acb2d0 100644 --- a/PunchingBag/src/uk/ac/open/punchingbag/PunchingBagGUI.java +++ b/PunchingBag/src/uk/ac/open/punchingbag/PunchingBagGUI.java @@ -53,6 +53,8 @@ import javax.sound.sampled.UnsupportedAudioFileException; import javax.sound.sampled.AudioFormat.Encoding; import javax.sound.sampled.Mixer.Info; +import uk.ac.open.punchingbag.examples.SimpleKeyboard; + import PicHelper.ImagePanel; public class PunchingBagGUI implements MouseListener, MouseMotionListener, @@ -82,7 +84,7 @@ public class PunchingBagGUI implements MouseListener, MouseMotionListener, new File(soundDir + "E5.wav"), new File(soundDir + "F5.wav"), new File(soundDir + "G5.wav") }; - String imageDirectory = System.getProperty("user.home"); + String imageDirectory = System.getProperty("user.home") + System.getProperty("file.separator") + "My Documents" + System.getProperty("file.separator") + "images"; static PunchingBag bag = PunchingBag.getBag(); @@ -92,6 +94,7 @@ public class PunchingBagGUI implements MouseListener, MouseMotionListener, public static void main(String[] args) throws InterruptedException { new PunchingBagGUI(); + new SimpleKeyboard(); } PunchingBagGUI() throws InterruptedException { @@ -225,7 +228,7 @@ public class PunchingBagGUI implements MouseListener, MouseMotionListener, if (debugImages) System.out.println("Moving to the next image "); try { - Thread.sleep(1000); + Thread.sleep(5000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -717,7 +720,7 @@ public class PunchingBagGUI implements MouseListener, MouseMotionListener, System.out.println("Button Pressed: " + x + " " + y); // bag.circleExpand(x, y, 16); // bag.setLED(x, y, Color.red); - bag.noise(new Rectangle(0, 0, 9, 20), 5000); + //bag.noise(new Rectangle(0, 0, 9, 20), 5000); /* * for (int bx=0; bx