Exemple #1
0
 /**
  * Plays a sound file from the NXT. SoundSensor files use the .rso extension. The filename is not
  * case sensitive. Filenames on the NXT Bricks display do now show the filename extension.
  *
  * @param fileName e.g. "Woops.rso"
  * @param repeat true = repeat, false = play once.
  * @return If you receive a non-zero number, the filename is probably wrong or the file is not
  *     uploaded to the NXT brick.
  */
 public static byte playSoundFile(String fileName, boolean repeat) {
   try {
     return nxtCommand.playSoundFile(fileName, repeat);
   } catch (IOException ioe) {
     System.out.println(ioe.getMessage());
     return -1;
   }
 }
Exemple #2
0
 /**
  * Stops a sound file that has been playing/repeating.
  *
  * @return Error code.
  */
 public static int stopSoundPlayback() {
   try {
     return nxtCommand.stopSoundPlayback();
   } catch (IOException ioe) {
     System.out.println(ioe.getMessage());
     return -1;
   }
 }
Exemple #3
0
 public static int playTone(int frequency, int duration) {
   try {
     return nxtCommand.playTone(frequency, duration);
   } catch (IOException ioe) {
     System.out.println(ioe.getMessage());
     return -1;
   }
 }