Page 2 of 3

Re: NXT Grayscale Screen?

Posted: 26 Feb 2011, 07:51
by mattallen37
Ah, you're right. Thanks for correcting me on that. I have no idea why I though the ATMEGA controlled it.

Re: NXT Grayscale Screen?

Posted: 26 Feb 2011, 21:58
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);
}


Re: NXT Grayscale Screen?

Posted: 26 Feb 2011, 22:41
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.

Re: NXT Grayscale Screen?

Posted: 27 Feb 2011, 00:25
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. ;) )

Re: NXT Grayscale Screen?

Posted: 28 Feb 2011, 07:52
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

Re: NXT Grayscale Screen?

Posted: 28 Feb 2011, 08:21
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

Re: NXT Grayscale Screen?

Posted: 28 Feb 2011, 09:22
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

Re: NXT Grayscale Screen?

Posted: 28 Feb 2011, 10:45
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).

Re: NXT Grayscale Screen?

Posted: 28 Feb 2011, 15:53
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

Re: NXT Grayscale Screen?

Posted: 28 Feb 2011, 17:34
by nxtboyiii
So waht about using halftone and putting flashing black pixels over it?