Cant Upload Code for Color Sensor

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

Cant Upload Code for Color Sensor

Postby Damian » Sat Apr 12, 2014 8:30 am

Hi all,

I found a sample code from the internet

Code: Select all
import lejos.nxt.Button;
import lejos.nxt.LCD;
import lejos.nxt.SensorPort;
import lejos.nxt.addon.ColorHTSensor;
import lejos.robotics.Color;

/**
 * For testing the HiTechnic color sensor (see lejos.nxt.addon.ColorHTSensor).
 * @author BB
 */
public class ColorDetector {

   final static int INTERVAL = 200; // milliseconds

   public static void main(String [] args) throws Exception {
      ColorHTSensor cmps = new ColorHTSensor(SensorPort.S1);
      String color = "Color";
      String r = "R";
      String g = "G";
      String b = "B";

      String[] colorNames = {"Red", "Green", "Blue", "Yellow", "Magenta", "Orange",
                         "White", "Black", "Pink", "Gray", "Light gray", "Dark Gray", "Cyan"
      };

      while(!Button.ESCAPE.isDown()) {
         LCD.clear();
         LCD.drawString(cmps.getVendorID(), 0, 0);
         LCD.drawString(cmps.getProductID(), 0, 1);
         LCD.drawString(cmps.getVersion(), 9, 1);
         LCD.drawString(color, 0, 3);
         LCD.drawInt(cmps.getColorID(),7,3);
         LCD.drawString(colorNames[cmps.getColorID()], 0, 4);
         LCD.drawString(r, 0, 5);
         LCD.drawInt(cmps.getRGBComponent(Color.RED),1,5);
         LCD.drawString(g, 5, 5);
         LCD.drawInt(cmps.getRGBComponent(Color.GREEN),6,5);
         LCD.drawString(b, 10, 5);
         LCD.drawInt(cmps.getRGBComponent(Color.BLUE),11,5);
         LCD.refresh();
         Thread.sleep(INTERVAL);
      }
   }
}


When I try to upload it I am having these errors:

Program has been linked successfully
Uploading ...
Found NXT: NXT 0016530D2942
lejos.nxt.remote.LCPException: Directory full
at lejos.nxt.remote.NXTCommand.openWrite(NXTCommand.java:179)
at lejos.nxt.remote.NXTCommand.uploadFile(NXTCommand.java:398)
at lejos.pc.tools.Upload.upload(Upload.java:46)
at lejos.pc.tools.NXJUpload.run(NXJUpload.java:93)
at lejos.pc.tools.NXJUpload.start(NXJUpload.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at lejos.pc.tools.ToolStarter.startTool(ToolStarter.java:31)
at lejos.pc.tools.NXJUpload.main(NXJUpload.java:29)
uploading the program failed with exit status 1


I would be glad if someone can help, Im trying to upload via USB.
Damian
New User
 
Posts: 14
Joined: Sat Apr 12, 2014 8:27 am

Re: Cant Upload Code for Color Sensor

Postby gloomyandy » Sat Apr 12, 2014 9:35 am

It tells you what is wrong. The directory on the NXT is full. You may need to format and/or delete all files stored on the NXT (use the menu to do this), then restart the NXT and try again.
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Cant Upload Code for Color Sensor

Postby Damian » Sat Apr 12, 2014 9:36 am

But uploading another code worked, only this one doesnt work.
Damian
New User
 
Posts: 14
Joined: Sat Apr 12, 2014 8:27 am

Re: Cant Upload Code for Color Sensor

Postby gloomyandy » Sat Apr 12, 2014 5:03 pm

Did you try doing what I suggested? Did it work?
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Cant Upload Code for Color Sensor

Postby Damian » Thu Apr 17, 2014 9:34 am

Thanks deleting the previous programs worked! I didnt think having only 2 small programs would cause this kind of error.
Damian
New User
 
Posts: 14
Joined: Sat Apr 12, 2014 8:27 am

Re: Cant Upload Code for Color Sensor

Postby gloomyandy » Thu Apr 17, 2014 7:50 pm

The file system used by leJOS on the NXT is very simplistic. Sometimes there can be plenty of space but it runs out of directory entries.
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4004
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK


Return to NXJ Software

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 1 guest

more stuff