diff options
author | Christopher Baines <cbaines8@gmail.com> | 2011-09-13 10:53:16 +0100 |
---|---|---|
committer | Christopher Baines <cbaines8@gmail.com> | 2011-09-13 10:53:16 +0100 |
commit | 116fbc975315dc88fd87dda4a941cfb57ea1f94f (patch) | |
tree | 719aee0d5704bd4f5389be1587b96021d942fde1 | |
parent | 0e1a25d62e358f017faf6ee9735a668161dc640d (diff) | |
download | punchingbag-116fbc975315dc88fd87dda4a941cfb57ea1f94f.tar punchingbag-116fbc975315dc88fd87dda4a941cfb57ea1f94f.tar.gz |
Improved drawCircle.
-rwxr-xr-x | Arduino/ButtonMatrix/ButtonMatrix.pde | 2 | ||||
-rw-r--r-- | PunchingBag/src/PunchingBag.java | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/Arduino/ButtonMatrix/ButtonMatrix.pde b/Arduino/ButtonMatrix/ButtonMatrix.pde index 702e487..d3a0874 100755 --- a/Arduino/ButtonMatrix/ButtonMatrix.pde +++ b/Arduino/ButtonMatrix/ButtonMatrix.pde @@ -3,6 +3,7 @@ const byte ROWS = 19; const byte COLS = 8; +// Top // these constants describe the pins for the acellarometer . They won't change: const int agroundpin = A4; // analog input pin 4 -- ground const int apowerpin = A5; // analog input pin 5 -- voltage @@ -11,6 +12,7 @@ const int aypin = A2; // y-axis const int azpin = A1; // z-axis (only on 3-axis models) const int aselfTest = A0; +// Bottom // these constants describe the pins for the acellarometer . They won't change: const int bgroundpin = A12; // analog input pin 4 -- ground const int bpowerpin = A13; // analog input pin 5 -- voltage diff --git a/PunchingBag/src/PunchingBag.java b/PunchingBag/src/PunchingBag.java index f27738f..271ef60 100644 --- a/PunchingBag/src/PunchingBag.java +++ b/PunchingBag/src/PunchingBag.java @@ -166,6 +166,7 @@ public class PunchingBag implements Runnable { double currentRadius = 0.5; public CircleExpand(int x, int y, int intensity) { + System.out.println("Circle Expand"); this.x = x + 0.5; this.y = y + 0.5; this.intensity = intensity; @@ -391,8 +392,8 @@ public class PunchingBag implements Runnable { int px; int py; for (double i = 0; i < 360; i++) { - px = (int) (x + Math.round(radius * Math.cos(i))); - py = (int) (y + Math.round(radius * Math.sin(i))); + px = (int) Math.round(x + (radius * Math.cos(i))); + py = (int) Math.round(y + (radius * Math.sin(i))); if (x >= 0 && x <= 8 && y >= 0 && y <= 19) { if (setLEDInternal(px, py, colour)) { |