Hi, my partner and I are trying to do a project in which we just make random movements while it plays a song, can anyone help figure out why this doesn't compile? It's not important the details of what is happening with the bot I think we can fix that later, I'm just missing something obvious I think, if anyone could help that would be awesome.
import lejos.nxt.*;
import lejos.robotics.navigation.DifferentialPilot;
public class Tune
{
private DifferentialPilot bot; //field declaration for a DifferentialPilot object
//the code in the main method will not change (except for the classname)
public static void main(String[] args)
{
Tune myProgram = new Tune(); //matches classname (case-sensitive)
myProgram.run();
}//main(){
private static final short [] note = {
0,114, 294,13, 0,15, 392,13, 0,15, 370,27, 0,1, 392,13, 0,1, 440,13,
0,1, 494,13, 0,15, 392,13, 0,15, 440,13, 0,1, 494,13, 0,1, 523,13,
0,1, 659,13, 0,1, 587,13, 0,15, 392,13, 0,15, 587,13, 0,15, 392,13,
0,15, 440,13, 0,1, 392,13, 0,1, 370,13, 0,1, 392,13, 0,1, 440,13,
0,15, 330,27, 0,1, 294,13, 0,15, 392,13, 0,15, 370,27, 0,1, 392,13,
0,1, 440,13, 0,1, 494,13, 0,15, 392,13, 0,15, 440,27, 0,1, 494,13,
0,1, 523,13, 0,1, 587,13, 0,15, 392,13, 0,15, 659,13, 0,15, 392,13,
0,15, 494,13, 0,1, 440,13, 0,1, 392,13, 0,1, 370,13, 0,1, 392,56,
0,1, 294,13, 0,15, 392,13, 0,15, 370,27, 0,1, 392,13, 0,1, 440,13,
0,1, 494,13, 0,15, 392,13, 0,15, 440,13, 0,1, 494,13, 0,1, 523,13,
0,1, 659,13, 0,1, 587,13, 0,15, 392,13, 0,15, 587,13, 0,15, 392,13,
0,15, 440,13, 0,1, 392,13, 0,1, 370,13, 0,1, 392,13, 0,1, 440,13,
0,15, 330,27, 0,1, 294,13, 0,15, 392,13, 0,15, 370,27, 0,1, 392,13,
0,1, 440,13, 0,1, 494,13, 0,15, 392,13, 0,15, 440,27, 0,1, 494,13,
0,1, 523,13, 0,1, 587,13, 0,15, 392,13, 0,15, 659,13, 0,15, 392,13,
0,15, 494,13, 0,1, 440,13, 0,1, 392,13, 0,1, 370,13, 0,1, 392,56,
0,1, 370,13, 0,1, 392,13, 0,1, 440,13, 0,1, 494,13, 0,1, 440,13,
0,15, 587,27, 0,1, 554,27, 0,1, 659,27, 0,1, 440,27, 0,1, 494,13,
0,1, 554,13, 0,1, 587,27, 0,1, 494,27, 0,1, 440,27, 0,1, 392,27,
0,1, 370,27, 0,1, 330,13, 0,1, 392,13, 0,1, 370,27, 0,1, 294,27,
0,1, 277,27, 0,1, 294,27, 0,1, 330,42, 0,1, 294,13, 0,1, 330,27,
0,1, 370,27, 0,1, 392,42, 0,1, 370,13, 0,1, 392,27, 0,1, 440,27,
0,1, 494,13, 0,1, 440,13, 0,1, 392,13, 0,1, 370,13, 0,1, 330,13,
0,1, 370,13, 0,1, 392,13, 0,1, 370,13, 0,1, 330,56, 0,1, 370,13,
0,1, 392,13, 0,1, 440,13, 0,1, 494,13, 0,1, 440,13, 0,15, 587,27,
0,1, 554,27, 0,1, 659,27, 0,1, 440,27, 0,1, 494,13, 0,1, 554,13,
0,1, 587,27, 0,1, 494,27, 0,1, 440,27, 0,1, 392,27, 0,1, 370,27,
0,1, 415,27, 0,1, 440,56, 0,1, 330,27, 0,1, 392,27, 0,1, 370,27,
0,1, 294,27, 0,1, 330,56, 0,1, 330,42, 0,1, 294,13, 0,1, 330,27,
0,1, 392,27, 0,1, 370,27, 0,1, 294,27, 0,1, 330,56, 0,1, 330,56,
0,1, 392,27, 0,1, 494,27, 0,1, 440,27, 0,1, 370,27, 0,1, 392,56,
0,1, 392,42, 0,1, 370,13, 0,1, 392,27, 0,1, 494,27, 0,1, 440,27,
0,1, 370,27, 0,1, 392,56, 0,1, 392,56, 0,1, 330,27, 0,1, 392,27,
0,1, 370,27, 0,1, 294,27, 0,1, 330,56, 0,1, 330,42, 0,1, 294,13,
0,1, 330,27, 0,1, 392,27, 0,1, 370,27, 0,1, 294,27, 0,1, 330,56,
0,1, 330,56, 0,1, 392,27, 0,1, 494,27, 0,1, 440,27, 0,1, 370,27,
0,1, 392,56, 0,1, 392,42, 0,1, 370,13, 0,1, 392,27, 0,1, 494,27,
0,1, 440,13, 0,1, 494,13, 0,1, 523,13, 0,1, 659,13, 0,1, 587,27,
0,1, 392,27, 0,1, 370,56, }
;
//bot movement starts here
{
}
{ for(int i=0;i<note.length; i+=2) {
final short w = note[i+1];
final int n = note[i];
if (n != 0) Sound.playTone(n, w*10);
try { Thread.sleep(w*10); } catch (InterruptedException e) {}
}
}
public void tuny(Button button) //called when the ESCAPTE button is pressed
{
for(int i=0;i<note.length; i+=2) {
final short w = note[i+1];
final int n = note[i];
if (n != 0) Sound.playTone(n, w*10);
try { Thread.sleep(w*10); } catch (InterruptedException e) {}
}
public void run();
bot.rotate(1000);
}
}
