Problem using own written classes

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

Moderators: imaqine, 99jonathan, roger

New User
Posts: 2
Joined: Thu Feb 21, 2008 10:22 am

Problem using own written classes

Postby penoH » Thu Feb 21, 2008 10:32 am

Hi all,

I'm trying to write a little project for LeJOS NXJ using some classes from the API (LCD, Motor, ...) and some own classes.
In the main class, an object is instantiated from an own written class. The compiler doesn't complain at any moment. But the program on the brick doesn't seem to pass the line where the object is made. I use this test program:

Code: Select all

import lejos.nxj.*;

public static void main(String[] args) {
    Robot robot = new Robot(0,0, Direction direction);
    LCD.drawString(1,1,"Line reached");
        //nothing to do here

The LCD doesn't show anything... The constructor from Robot has just 2 integers and a direction object from our own class in his signature.

Anybody any idea?

Thanks for reading this in the first place :)

New User
Posts: 5
Joined: Tue Oct 30, 2007 3:01 pm

Postby chewie » Thu Feb 21, 2008 4:15 pm

I would have no idea why the compiler is not complaining because the LCD.drawString is in the wrong order.... it goes drawString("String", x position, y position) not drawString(x, y, "String"). I would also add a LCD.clear() (so the screen will be clear of anything else that might have been put on there) and Thread.sleep(500) (so you can actually see the screen display something). Here is my usual block of code to write something to the screen:

Code: Select all

LCD.drawString("Hello World!", 0, 0);

Return to “NXJ Software”

Who is online

Users browsing this forum: No registered users and 2 guests