aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2011-09-16 11:32:32 +0100
committerChristopher Baines <cbaines8@gmail.com>2011-09-16 11:32:32 +0100
commite4a1768e5928f899380483404995c0e5e555376e (patch)
tree59d77e562e68f1f51e4db0b027f11d3bc2f5de01
parentebc965a9f1dc2a1a6aaf66a0c048695eda3a7a25 (diff)
downloadpunchingbag-e4a1768e5928f899380483404995c0e5e555376e.tar
punchingbag-e4a1768e5928f899380483404995c0e5e555376e.tar.gz
Chnages for touch screen.
-rw-r--r--PunchingBag/src/uk/ac/open/punchingbag/PunchingBag.java4
-rw-r--r--PunchingBag/src/uk/ac/open/punchingbag/PunchingBagGUI.java9
-rw-r--r--PunchingBag/src/uk/ac/open/punchingbag/examples/SimpleKeyboard.java2
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<bag.ledWidth; bx++) { for (int by=0;
* by<bag.ledHeight; by++) { bag.setLED(bx, by, PunchingBag.Colour.Red);
diff --git a/PunchingBag/src/uk/ac/open/punchingbag/examples/SimpleKeyboard.java b/PunchingBag/src/uk/ac/open/punchingbag/examples/SimpleKeyboard.java
index b34fde9..a8d32ff 100644
--- a/PunchingBag/src/uk/ac/open/punchingbag/examples/SimpleKeyboard.java
+++ b/PunchingBag/src/uk/ac/open/punchingbag/examples/SimpleKeyboard.java
@@ -31,7 +31,7 @@ public class SimpleKeyboard implements ButtonListener {
new SimpleKeyboard();
}
- SimpleKeyboard() {
+ public SimpleKeyboard() {
bag.addButtonListener(this);
try {
bag.connectToArduinos();