Skip to content

Commit

Permalink
Crap commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hlfbt committed Sep 23, 2012
1 parent be3eb22 commit f1aa70d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/me/mastermind/NXJ_pc/Receiver.java
@@ -1,9 +1,8 @@
package me.mastermind.NXJ_pc;

import java.io.InputStream;
import lejos.pc.comm.NXTCommInputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import lejos.pc.comm.NXTCommInputStream;

/**
*
Expand All @@ -17,7 +16,6 @@ public void run() {
while(true) {
try {
data = nxtIn.read();
System.out.println(data);
if (data == 255) {
System.out.println("Shutdown by NXT");
System.exit(0);
Expand Down
12 changes: 11 additions & 1 deletion src/me/mastermind/NXJ_pc/RemoteController.java
@@ -1,5 +1,7 @@
package me.mastermind.NXJ_pc;

import java.util.logging.Level;
import java.util.logging.Logger;
import lejos.pc.comm.NXTComm;

/**
Expand Down Expand Up @@ -30,7 +32,15 @@ public static boolean initalize() {
}

public static boolean write(int data) {
return nxt.writeData(data);
try {
receiver.wait();
} catch (InterruptedException ex) {
System.out.println("\n\n\nwait error\n\n\n");
Logger.getLogger(RemoteController.class.getName()).log(Level.SEVERE, null, ex);
}
boolean success = nxt.writeData(data);
receiver.notify();
return success;
}

public static void kill() {
Expand Down

0 comments on commit f1aa70d

Please sign in to comment.