Page 2 of 7

Re: NXT PROBLEM

Posted: 15 Jun 2013, 14:52
by naneczek
But the line is not saved for one second on the DISPLAY! The line is going slower, but I wanted the line to save for one second on the display and after that the next measurement should be done, saved for one second and so on...

Re: NXT PROBLEM

Posted: 15 Jun 2013, 16:01
by HaWe
I don't quite understand what you mean exactly but I changed the code.

Re: NXT PROBLEM

Posted: 15 Jun 2013, 17:51
by naneczek
Ok, I'll just put it in a few simple points:

1.The measurements goes through the whole display and freezes
2. While this whole measurement line is depicted on the display, the other measurement is on
3. When this other measurement is done, it is depicted on the display (whole one, not pixel by pixel, but the whole line appears.

So that's the case. I don't want to see the process of the measurement, but the final (whole) result on the display. Now you get it?

Re: NXT PROBLEM

Posted: 17 Jun 2013, 08:10
by HaWe
sorry, I don't understand what you want.
My Google translate gives me just crap.
Maybe a native English speaker could help yu better.

Re: NXT PROBLEM

Posted: 17 Jun 2013, 16:56
by naneczek
Ok, I'll just put it in a few simple points:

1.The measurement goes through the whole display and freezes when it reaches the end of the display(the whole line is depicted)
2. While this whole measurement line is depicted on the display, the other measurement is on(unvisible on the display)
3. When this other measurement is done,the previous line is deleted and the current is depicted on the display (whole one, not pixel by pixel, but the whole line appears).

So that's the case. I don't want to see the process of the measurement, but the final (whole line) result on the display. The measurements are represented by the whole lines, not by the process of pixels one by one. Now you get it?

I know it should be done on two arrays. But I just simply don't know how to achieve it in code....

Re: NXT PROBLEM

Posted: 17 Jun 2013, 19:17
by HaWe
try to write your own pseudo code, and then transform it in to NXC code!

do in a loop:

start:
for I=0 to 99 array= USS value (unvisible)
ClearScreen
for i=0 to 99 display point (x=i, y=array/4) on the screen
maybe wait a certain time additionally
goto start.

do this forever

Re: NXT PROBLEM

Posted: 17 Jun 2013, 19:36
by naneczek
Sth like this?

Code: Select all

task main() {
  ClearScreen();
  int y;
  int i;
  int Array;

  SetSensorLowspeed(IN_4);
  
     loop
    for I=0 to 99 array[i]= USS value {
    if (i>=100) {i=0; ClearScreen();}
    y = SensorUS(IN_4);
    PointOut(i, y/4, DRAW_OPT_NORMAL);
    NumOut(0,56, y, DRAW_OPT_CLEAR);
    for i=0 to 99 display point (x=i, y=array[i]/4)

  }

  while (true);
}
For the time being I don't have an opportunity to check this code on a lego robot, so that I cannot see the resulta. The point here is that the robot is gathering measurements into the first array whereas from the second array the measurements are loaded so that it works as I have written.

Re: NXT PROBLEM

Posted: 17 Jun 2013, 22:14
by HaWe
now try to find the syntax errors and to improve your code!
Most of the correct syntax I've shown you before.

Maybe buy some books about NXC programming and make some tutorials!

Re: NXT PROBLEM

Posted: 18 Jun 2013, 16:00
by naneczek
I wish you could help me with this code. Just once, and explain why and what...you are here the best.

Re: NXT PROBLEM

Posted: 19 Jun 2013, 10:20
by HaWe
hey,
of course I will help you but I can not pre-chew and pre-digest anything and everything, and you must be able to debug your code and test your code by yourself.

So if you wish, debug it, clean it, test it, and post the results, and maybe I then can help you further on - or anyone else here in this forum (there are actually lot of people here who understand tons more of this stuff than I do). And I really am not sure if I already understood your problem right because it still sounds very confused and unintelligible to me what you really want.
But let's wait and see what happens if you finnaly got your code testet by yousrself with what results ever.

And of course you will need to have a NXT of your own and constantly available!