NXT Grayscale Screen?

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXT Grayscale Screen?

Post by mattallen37 »

Ah, you're right. Thanks for correcting me on that. I have no idea why I though the ATMEGA controlled it.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
timpattinson
Posts: 224
Joined: 30 Oct 2010, 04:10
Location: 127.0.0.1
Contact:

Re: NXT Grayscale Screen?

Post by timpattinson »

If all you want to do is change the color of the whole screen you can use SetDisplayContrast() in NXC (This requires EFW 1.28+)

This is the sample program from the NXC Guide

Code: Select all

task main()
{
  for (byte contrast = 0; contrast < DISPLAY_CONTRAST_MAX; contrast++)
  {
    SetDisplayContrast(contrast);
    NumOut(0, LCD_LINE1, DisplayContrast(),);
    Wait(100);
  }
  for (byte contrast = DISPLAY_CONTRAST_MAX; contrast > 0; contrast--)
  {
    SetDisplayContrast(contrast);
    NumOut(0, LCD_LINE1, DisplayContrast());
    Wait(100);
  }
  SetDisplayContrast(DISPLAY_CONTRAST_DEFAULT);
  NumOut(0, LCD_LINE1, DisplayContrast());
  while(true);
}

Commit to Lego Mindstorms StackExchange Q&A http://area51.stackexchange.com/proposals/4105
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXT Grayscale Screen?

Post by mattallen37 »

timpattinson wrote:If all you want to do is change the color of the whole screen you can use SetDisplayContrast() in NXC (This requires EFW 1.28+)...
They want actual grayscale.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: NXT Grayscale Screen?

Post by muntoo »

timpattinson wrote:If all you want to do is change the color of the whole screen you can use SetDisplayContrast() in NXC (This requires EFW 1.28+)...
Hmm... can you change this at a frequency greater than 10Hz?

---

If the viewer is d cm distance away from the NXT, you can try "halftones":

Code: Select all

void GS_RectOut(int x, int y, int width, int height, unsigned long options=DRAW_OPT_NORMAL, int blockSize = 2)
{
    for(int _y = y; _y < (y + height + 1); _y++)
    {
        for(int _x = x; _x < (x + width + 1); _x++)
        {
            PointOut(_x, _y, ((_x % blockSize) + (_y % blockSize)) % blockSize);
        }
    }
}
Of course, this is really crude, and you could probably get a much nicer blend if you make a better algorithm. (You may need to know the output before hand, though, if you really want it to look "pretty".)
Also, the changing the "options" argument won't really do anything as you would expect it to. I haven't added that functionality for sake of simplicity. I'm not sure if "blockSize" will work as I expect it to if you change it to any value other than 2... (This is just an example; I'm not going to waste brain CPU on this! ...I think Doc had the right idea: do the "hard" stuff, but not the "easy" stuff. ;) )
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
timpattinson
Posts: 224
Joined: 30 Oct 2010, 04:10
Location: 127.0.0.1
Contact:

Re: NXT Grayscale Screen?

Post by timpattinson »

muntoo wrote:
timpattinson wrote:If all you want to do is change the color of the whole screen you can use SetDisplayContrast() in NXC (This requires EFW 1.28+)...
Hmm... can you change this at a frequency greater than 10Hz?
Will test this ... stay tuned
Commit to Lego Mindstorms StackExchange Q&A http://area51.stackexchange.com/proposals/4105
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
timpattinson
Posts: 224
Joined: 30 Oct 2010, 04:10
Location: 127.0.0.1
Contact:

Re: NXT Grayscale Screen?

Post by timpattinson »

Have done a test with this code...

Code: Select all


task main()
{
  bool max = false;
  unsigned long timer = CurrentTick();
  for(int i = 0; i < INT_MAX; i++)
  {
      if(max)
      {
      SetDisplayContrast(DISPLAY_CONTRAST_DEFAULT);
      }
      else
      {
      SetDisplayContrast(DISPLAY_CONTRAST_MAX);
      }
      max = !max;
  }
  TextOut(0,LCD_LINE1,StrCat( NumToStr(CurrentTick() - timer),"ms" ,"/", NumToStr(INT_MAX)));
  SetDisplayContrast(DISPLAY_CONTRAST_DEFAULT);
  while(1);
}
It takes 8914ms to change the contrast 32767 times (i used an int as the counter variable , this is the max of the int type)
-Tim
Commit to Lego Mindstorms StackExchange Q&A http://area51.stackexchange.com/proposals/4105
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: NXT Grayscale Screen?

Post by mightor »

Sure, you can send the command that frequently, but does the LCD screen processor actually do anything with that changed info more than 10 times a second? It would be no different than changing the motor speeds every 1ms in your program when the ATmega only updates it every 3ms.

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXT Grayscale Screen?

Post by mattallen37 »

You were probably just using made up numbers in that motor update speed example, because IIRC, with standard FW, it is every 100ms, not 3ms (for your/others information).
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: NXT Grayscale Screen?

Post by mightor »

The ARM7 and ATmega chat each 3ms from what I've understood. Perhaps the motor example was not a very good one, but you get what I mean :)

A better example would be the PELICAN crossing system. Pressing the button repeatedly to make the little man turn green isn't going to make him change any faster. That never seems to stop people, though.

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
nxtboyiii
Posts: 366
Joined: 02 Oct 2010, 07:08
Location: Everywhere

Re: NXT Grayscale Screen?

Post by nxtboyiii »

So waht about using halftone and putting flashing black pixels over it?
Thanks, and have a nice day,
nxtboy III

programnxt.com
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests