Shop OBEX P1 Docs P2 Docs Learn Events
web based LCD display hosted by a PINK — Parallax Forums

web based LCD display hosted by a PINK

DgswanerDgswaner Posts: 795
edited 2007-10-03 21:25 in General Discussion
I know there has to be a simple way of doing this, taking 123 and separating it out into 1 2 3 each digit held in a separate variable.

Purpose: I want to make a Web LCD Display for my PINK, to display sensor readouts. I've made the LCD digit images 0-9. So if a temp sensor reads 123 deg, the pink would hold 3 values 1, 2, 3, in 3 different variables. and would use those values to display 1.jpg, 2.jpg, 3.jpg. and the images would change as the values change.

is DIG the best command for this. running through a for next loop incrementing the dig value and PINK variable, I kinda want a catch all app where I don't have to worry about number lengths and would like to have the possibility of alpha numeric also. Just want to get some input before I go the long way around the mountain.

I would actually like this to be handled on the PINK in html or Java script so I don't have to use up 2+ variables for every input. but that's beyond my limits.

your input is appreciated. and I'll post my full code and images once it's working... I need to fix some of the images also.

thanks

added:
this is for a BS2SX and eventually I'll want to do it on a Propeller.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster

Post Edited (Dgswaner) : 10/2/2007 2:29:48 PM GMT
72 x 208 - 3K
72 x 208 - 4K
72 x 208 - 4K

Comments

  • DgswanerDgswaner Posts: 795
    edited 2007-10-02 13:45
    I'm not feelin the love on this project! I guess I'm alone on this one. I'll post my work anyway, and if you want to see it in action you can view it at 71.219.85.247/LCDtest.html at least until my IP changes.

    why is the counting is skipping? the BS2 and the refresh rate are set to 1 sec. and don't sync, add a bit of lag and you have skipping.

    My images aren't on the pink to save space so you'll need to change URL for the images. If you want to use the code on your own pink.

    the DIG command works pretty good but I haven't really looked into what happens if you DIG past the length of a number.


    Comments are more than welcome. I have plans to make a 4x16 alpha numeric display but I'm going to wait on that one.

    I'd love input on how to refresh the images with AJAX or how to separate the digits in HTML or JAVA.


    Oh ya the code!

    Added the blue text

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster

    Post Edited (Dgswaner) : 10/2/2007 6:20:51 PM GMT
    LCD.zip 40.8K
  • skylightskylight Posts: 1,915
    edited 2007-10-02 17:33
    I'm sure thats not the case and a lot of people are interested in your project.
    I personally havn't replied as i didn't know the solution, but I do like the graphics you designed they are very lifelike, and i like the demo, although i didn't have to change the URL or anything to get it to run i just clicked on your link.
    Keep up the good work.
  • DgswanerDgswaner Posts: 795
    edited 2007-10-02 18:17
    thanks... didn't mean to sound like I was having a pity party.... If you were to use the html file on your PINK/web server the images are hard coded to my personal site, not on the PINK. So would I would prefer to have them directed to your own web server.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster
  • Harrison.Harrison. Posts: 484
    edited 2007-10-02 19:33
    If you want the most simple javascript possible then try this:

    <html>
    <head>
    <title>Counter</title>
    <script language="javascript">
    var numbers = '<nb_var0>';
    function makeDigits() {
         for(var i = 0; i < numbers.length; i++) {
              document.write('<img src="http://myserver.com/images/LCD-' + numbers.charAt(i) + '.png">');
         }
    }
    </script>
    </head>
    <body>
    
    The pretty numbers are: <br/>
    <script language="javascript">makeDigits();</script>
    
    </body>
    </html>
    
    



    You may be asking "Why use the inefficient string?". The reason is that some people may want to use other characters too (like hex or something). By using javascript strings, you get ultimate flexibility. In fact, it may be even more efficient then numbers if your browser stores strings as an array of chars. Not to mention you don't have to worry about overflowing any integers and such.

    EDIT: Added missing quotation.

    Harrison

    Post Edited (Harrison.) : 10/2/2007 7:39:32 PM GMT
  • DgswanerDgswaner Posts: 795
    edited 2007-10-02 20:24
    Harrison! thanks a ton! that's exactly what I was looking for. here it is in action. 71.219.85.247/LCDJavaTest.html I don't have dreamweaver installed at work and I'm not too good at editing things in notepad so I didn't add anything fancy but it works great! This will free up CPU time and variables on the bs2.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster
  • skylightskylight Posts: 1,915
    edited 2007-10-03 17:11
    should the numbers be changing like on the last link, as thy are not on my screen?
  • DgswanerDgswaner Posts: 795
    edited 2007-10-03 21:25
    I was going to make that page count, but alas I forgot, I can't program my BS2 from work, I'll do something with it tonight.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster
Sign In or Register to comment.