Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
Showing with 896 additions and 37 deletions.
  1. +42 −0 docs/Opening/opening.tex
  2. +9 −7 src/Controller.java
  3. +2 −5 src/Engine.java
  4. +804 −0 src/Entertain.java
  5. +13 −3 src/Intelligence.java
  6. +26 −22 src/Remote.java
View
42 docs/Opening/opening.tex
@@ -0,0 +1,42 @@
+\begin{titlepage}
+\pagestyle{plain}
+\lhead{}
+\rhead{}
+\cfoot{Carroll College 2012\\Mathematics, Computer Science, \& Engineering}
+% ---------------- TITLE PAGE ------------------%
+\title{CS 430: Senior Project\\Robotics}
+\author{\small{Students}\\
+Nathan Woods, Jennings Anderson \\Shae Tiegen, Forrest Laskowski\\[2mm]
+\small{Professor}\\
+Steve Harper}
+\date{\small{Term}\\
+Spring 2012}
+\maketitle
+
+%---------------- ABSTRACT -------------------%
+\begin{abstract}
+``Robo"
+
+\end{abstract}
+\end{titlepage}
+
+\newpage
+\setcounter{page}{1}
+\pagenumbering{roman}
+%Header
+\pagestyle{fancyplain}
+\rhead{\fancyplain{}{\small{\textit{SIGNATURE PAGE}}}}
+\cfoot{\small{\thepage}}
+\clearpage
+
+%------------TABLE OF CONTENTS ---------------%
+
+%Header
+\pagestyle{fancyplain}
+\rhead{\fancyplain{}{\small{\textit{TABLE OF CONTENTS}}}}
+\cfoot{\small{\thepage}}
+\singlespace
+\tableofcontents
+
+%And then clear for a new page.
+\clearpage
View
16 src/Controller.java
@@ -8,29 +8,31 @@
public class Controller {
public static void main(String args[]) {
+ new Entertain();
+
//Ignition
Engine engine = new Engine();
Thread engineThr = new Thread(engine);
- engineThr.setPriority(Thread.MAX_PRIORITY-2);
+ engineThr.setPriority(Thread.MAX_PRIORITY-3);
engineThr.start();
// Steering wheel
SteeringWheel wheel = new SteeringWheel();
Thread wheelThr = new Thread(wheel);
- wheelThr.setPriority(Thread.MAX_PRIORITY-3);
+ wheelThr.setPriority(Thread.MAX_PRIORITY-4);
wheelThr.start();
// Headlights
Sonar headlight = new Sonar();
Thread headlightThr = new Thread(headlight);
- headlightThr.setPriority(Thread.MAX_PRIORITY);
+ headlightThr.setPriority(Thread.MAX_PRIORITY-1);
headlightThr.start();
// GPS
GPS garmin = new GPS();
- Thread garminThr = new Thread(garmin);
- garminThr.setPriority(Thread.MAX_PRIORITY-4);
- garminThr.start();
+ //Thread garminThr = new Thread(garmin);
+ //garminThr.setPriority(Thread.MAX_PRIORITY-5);
+ //garminThr.start();
//Remote
Remote remote = new Remote();
@@ -41,7 +43,7 @@ public static void main(String args[]) {
// Brain
Intelligence brain = new Intelligence(engine, wheel, headlight, remote);
Thread brainThr = new Thread(brain);
- brainThr.setPriority(Thread.MAX_PRIORITY-1);
+ brainThr.setPriority(Thread.MAX_PRIORITY-2);
brainThr.start();
// Debugging - can comment out for production
View
7 src/Engine.java
@@ -85,11 +85,8 @@ else if (rpm < arrayOfSpeeds[velocity + 3])
//}
//limiter
- if (power > 16)
-
- power = 16;
- if (power < -16)
- power = -16;
+ if (power > 16) power = 16;
+ if (power < -16) power = -16;
motor.setPower(power);
// Pause thread execution
View
804 src/Entertain.java
@@ -0,0 +1,804 @@
+/**
+ * IntelliBrainOdeToJoy - plays the tune Ode to Joy using the IntelliBrain
+ * buzzer
+ *
+ * Copyright 2003, 2005 by RidgeSoft, LLC., PO Box 482, Pleasanton, CA 94566,
+ * U.S.A. www.ridgesoft.com
+ *
+ * RidgeSoft grants you the right to use, modify, make derivative works and
+ * redistribute this source file provided you do not remove this copyright
+ * notice.
+ */
+
+import com.ridgesoft.intellibrain.IntelliBrain;
+import com.ridgesoft.io.Speaker;
+
+public class Entertain implements Runnable {
+ public static final int QUARTER_NOTE = 150;
+ public static final int HALF_NOTE = QUARTER_NOTE * 2;
+ public static final int TRIPLET = (QUARTER_NOTE * 4) / 3;
+
+ public static final int C4 = 262;
+ public static final int C4_SHARP = 277;
+ public static final int D4 = 294;
+ public static final int D4_SHARP = 311;
+ public static final int E4 = 330;
+ public static final int F4 = 349;
+ public static final int F4_SHARP = 370;
+ public static final int G4 = 392;
+ public static final int G4_SHARP = 415;
+ public static final int A4 = 440;
+ public static final int A4_SHARP = 466;
+ public static final int B4 = 494;
+ public static final int C5 = 523;
+ public static final int C5_SHARP = 554;
+ public static final int D5 = 587;
+ public static final int D5_SHARP = 622;
+ public static final int E5 = 659;
+ public static final int F5 = 698;
+ public static final int F5_SHARP = 740;
+ public static final int G5 = 784;
+ public static final int G5_SHARP = 831;
+ public static final int A5 = 880;
+ public static final int A5_SHARP = 932;
+ public static final int B5 = 988;
+ public static final int C6 = 1024;
+ public static final int R = 0;
+
+ public Speaker buzzer;
+
+ public Entertain() {
+ buzzer = IntelliBrain.getBuzzer();
+ }
+
+ public void run() {
+ try {
+
+ //Mario Theme Broken into measures
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(G5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(G4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ for(int i = 1; i < 3; i++) {
+
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(B4, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4_SHARP, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(G4, TRIPLET);
+ buzzer.play(E5, TRIPLET);
+ buzzer.play(G5, TRIPLET);
+
+ buzzer.play(A5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(G5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+
+ buzzer.play(D5, QUARTER_NOTE);
+ buzzer.play(B4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ //END OF MEASURE 12
+
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(B4, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4_SHARP, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(G4, TRIPLET);
+ buzzer.play(E5, TRIPLET);
+ buzzer.play(G5, TRIPLET);
+
+ buzzer.play(A5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(G5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+
+ buzzer.play(D5, QUARTER_NOTE);
+ buzzer.play(B4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G5, QUARTER_NOTE);
+ buzzer.play(F5_SHARP, QUARTER_NOTE);
+
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(D5_SHARP, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4_SHARP, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(D5, QUARTER_NOTE);
+ //END OF MEASURE 24
+
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G5, QUARTER_NOTE);
+ buzzer.play(F5_SHARP, QUARTER_NOTE);
+
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(D5_SHARP, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C6, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C6, QUARTER_NOTE);
+
+ buzzer.play(C6, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G5, QUARTER_NOTE);
+ buzzer.play(F5_SHARP, QUARTER_NOTE);
+
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(D5_SHARP, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4_SHARP, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(D5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(D5_SHARP, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(D5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ //END OF MEASURE 36
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G5, QUARTER_NOTE);
+ buzzer.play(F5_SHARP, QUARTER_NOTE);
+
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(D5_SHARP, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4_SHARP, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(D5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G5, QUARTER_NOTE);
+ buzzer.play(F5_SHARP, QUARTER_NOTE);
+
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(D5_SHARP, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C6, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C6, QUARTER_NOTE);
+
+ buzzer.play(C6, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G5, QUARTER_NOTE);
+ buzzer.play(F5_SHARP, QUARTER_NOTE);
+
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(D5_SHARP, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4_SHARP, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(D5, QUARTER_NOTE);
+ //End of measure 48
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(D5_SHARP, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(D5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(D5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+
+ buzzer.play(G4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(D5, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ //End of measure 60
+
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(D5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+
+ buzzer.play(G4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(G5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(G4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(B4, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4_SHARP, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ //End of measure 72
+
+ buzzer.play(G4, TRIPLET);
+ buzzer.play(E5, TRIPLET);
+ buzzer.play(G5, TRIPLET);
+
+ buzzer.play(A5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(G5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+
+ buzzer.play(D5, QUARTER_NOTE);
+ buzzer.play(B4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(B4, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4_SHARP, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(G4, TRIPLET);
+ buzzer.play(E5, TRIPLET);
+ buzzer.play(G5, TRIPLET);
+
+ buzzer.play(A5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(G5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+
+ buzzer.play(D5, QUARTER_NOTE);
+ buzzer.play(B4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ //End of measure 84
+
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(F4_SHARP, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(B4, TRIPLET);
+ buzzer.play(A5, TRIPLET);
+ buzzer.play(A5, TRIPLET);
+
+ buzzer.play(A5, TRIPLET);
+ buzzer.play(G5, TRIPLET);
+ buzzer.play(F5, TRIPLET);
+
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+
+ buzzer.play(G4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4_SHARP, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ //End of measure 96
+
+ buzzer.play(B4, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+
+ buzzer.play(F5, TRIPLET);
+ buzzer.play(E5, TRIPLET);
+ buzzer.play(D5, TRIPLET);
+
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(E4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E4, QUARTER_NOTE);
+
+ buzzer.play(C4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4_SHARP, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(B4, TRIPLET);
+ buzzer.play(A5, TRIPLET);
+ buzzer.play(A5, TRIPLET);
+
+ buzzer.play(A5, TRIPLET);
+ buzzer.play(G5, TRIPLET);
+ buzzer.play(F5, TRIPLET);
+
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+
+ buzzer.play(G4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ //End of measure 108
+
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4_SHARP, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(B4, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+
+ buzzer.play(F5, TRIPLET);
+ buzzer.play(E5, TRIPLET);
+ buzzer.play(D5, TRIPLET);
+
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(E4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E4, QUARTER_NOTE);
+
+ buzzer.play(C4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(D5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+
+ buzzer.play(G4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ //End of measure 120
+
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(D5, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(D5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+
+ buzzer.play(G4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(G5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(G4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ //End of measure 132
+
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4_SHARP, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(B4, TRIPLET);
+ buzzer.play(A5, TRIPLET);
+ buzzer.play(A5, TRIPLET);
+
+ buzzer.play(A5, TRIPLET);
+ buzzer.play(G5, TRIPLET);
+ buzzer.play(F5, TRIPLET);
+
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(A4, QUARTER_NOTE);
+
+ buzzer.play(G4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(E5, QUARTER_NOTE);
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4, QUARTER_NOTE);
+
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(G4_SHARP, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+
+ buzzer.play(A4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ //End of measure 144
+
+ buzzer.play(B4, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(F5, QUARTER_NOTE);
+
+ buzzer.play(F5, TRIPLET);
+ buzzer.play(E5, TRIPLET);
+ buzzer.play(D5, TRIPLET);
+
+ buzzer.play(C5, QUARTER_NOTE);
+ buzzer.play(E4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(E4, QUARTER_NOTE);
+
+ buzzer.play(C4, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+ buzzer.play(R, QUARTER_NOTE);
+
+ }
+
+ } catch (Throwable t) { t.printStackTrace(); }
+ }
+}
View
16 src/Intelligence.java
@@ -37,24 +37,34 @@ public void run() {
double[] toAdd = new double[6];
toAdd[5] = 1.0;
long time = System.currentTimeMillis();
+ Entertain mario = new Entertain();
+ Thread music = new Thread();
try {
while (true) {
//check Remote
if (remote.isOn()){
+ if ( music == null ) {
+ music = new Thread(mario);
+ music.setPriority(Thread.MIN_PRIORITY + 1);
+ music.start();
+ }
motor.setSpeed(remote.getPort1());
steer.setBackWheels(remote.getPort2()*15+50);
steer.setFrontWheels(remote.getPort2()*15+50);
- }
- else{
-
+ } else{
+
if (!running) {
time += 2000;
Thread.sleep(time - System.currentTimeMillis());
continue;
}
+ if (music != null) {
+ music.stop();
+ }
+
sum0 = 0; sum1 = 0; sum2 = 0;
toAdd[0] = eyes.getDist('w');
View
48 src/Remote.java
@@ -6,42 +6,46 @@
private AnalogInput input1, input2;
private boolean remoteOn;
private int port1, port2;
+ private int sampleP1, sampleP2;
public Remote(){
input1 = IntelliBrain.getAnalogInput(2);
input2 = IntelliBrain.getAnalogInput(3);
-
}
public void run(){
+ long time = System.currentTimeMillis();
while(true){
- port1 = input1.sample()/5 - 11;
- port2 = input2.sample()/5 - 11;
- if ((port1 < -5 ) || ( port2 < -5))
- remoteOn = false;
- else
- remoteOn = true;
- try { Thread.sleep(500); } catch(Exception e) {};
+
+ sampleP1 = input1.sample();
+ sampleP2 = input2.sample();
+
+ sampleP1 += input1.sample();
+ sampleP2 += input2.sample();
+
+ sampleP1 += input1.sample();
+ sampleP2 += input2.sample();
+
+ port1 = sampleP1/15 - 12; // origionally divided by 5
+ port2 = sampleP2/15 - 12;
+
+ remoteOn = (port1 > -5 ) && ( port2 > -5);
+
+ try {
+ time += 100;
+ Thread.sleep(time - System.currentTimeMillis());
+ } catch(Exception e) {};
}
}
- public boolean isOn(){
- return remoteOn;
- }
- public int getPort1(){
- return port1;
- }
- public int getPort2(){
- return port2;
- }
public String[] toDebugString(String in[]) {
in[0] = "Remote Debug";
- String onOff = (isOn())? "On": "Off";
- in[1] = onOff+ " "+getPort1() + " " + getPort2();
+ in[1] = ( isOn() ? "On" : "Off" ) + " " + port1 + " " + port2;
return in;
}
- public void setRunning(boolean run) {
- running = run;
- }
+ public boolean isOn(){ return remoteOn; }
+ public int getPort1(){ return port1; }
+ public int getPort2(){ return port2; }
+ public void setRunning(boolean run) { running = run; }
}

No commit comments for this range

Something went wrong with that request. Please try again.