Shop OBEX P1 Docs P2 Docs Learn Events
Some way to get a 2x16 lcd to display the same thing and then have it change? — Parallax Forums

Some way to get a 2x16 lcd to display the same thing and then have it change?

herculeshercules Posts: 4
edited 2013-04-03 07:46 in BASIC Stamp
Currently my code looks like
' {$STAMP BS2}
' {$PBASIC 2.5}


TxPin     CON   1
n9600     CON   84


HIGH TxPin
PAUSE 100


DO


  IF IN3 = 1 THEN
     SEROUT TxPin, n9600, [12, 17]
     SEROUT TxPin, n9600, ["on"]
   ELSE
     SEROUT TxPin, n9600, [12, 17]
     SEROUT TxPin, n9600, ["off"]
  ENDIF
PAUSE 500
LOOP

The problem is that the lcd flashes it really fast and the text does not look solid if there is not a pause, and when there is you either have to hold down the switch or press it at the right time, which is not really what I'm going for.

Any help is appreciated! Thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-04-03 07:26
    The problem is that you're clearing the display (control code 12) each time you display something and that's the cause of the flicker. You do want to do that once during your initialization (say before the DO). When you write the value, just position the cursor where you want it and write the same number of characters each time (use "on " instead of "on") like

    SEROUT TxPin, n9600, [128, "on "] ' Position to row 0 column 0 and write text
  • herculeshercules Posts: 4
    edited 2013-04-03 07:46
    Ah! Thank you so much, that is exactly what I was looking for.
Sign In or Register to comment.