Shop OBEX P1 Docs P2 Docs Learn Events
Javelin uart — Parallax Forums

Javelin uart

Istha PowronIstha Powron Posts: 74
edited 2008-11-11 10:12 in General Discussion
Hi All,

I love the Javelin, it packs a lot of punch and is great for prototyping quickly.....However it is far too expensive to build into products.

I have a Uart problem......

I want to write; "Time = 332" as a serial output.

I know I can use uart.sendstring for "Time ="

I also know I can use uart.sendbyte to send individual characters, but how do I take the value of integer "Time" and send it as a string to an LCD? i.e.

What is the Javelin equivelant of SEROUT (, , "Time = ", DEC[noparse][[/noparse]Time})

ANy Help appreciated.

Istha

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔





The robot is going to lose. Not by much. But when the final score is tallied, flesh and blood will beat the damn monster.
Adam Smith

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-11-10 13:03
    The easiest way is to use the Format package.

    char buf[noparse][[/noparse]20]; //to hold string output
    int time = 23;
    Format.sprintf(buf,"time = %d",time);

    generates "time = 23",0 in array buf

    My adapted Uart class has a sendString method that takes a char array as parameter
    so you can use afterwards
    myUart.sendString(buf);

    The·Format class is here:
    http://tech.groups.yahoo.com/group/JavelinCode/files/Javelin%20Stamp%20IDE/lib/stamp/util/text/

    My adapted Uart class:
    http://tech.groups.yahoo.com/group/JavelinCode/files/Javelin%20Stamp%20IDE/lib/stamp/core/

    regards peter
  • Istha PowronIstha Powron Posts: 74
    edited 2008-11-11 09:04
    Thank's Peter,

    Can you point me to a good link that explains how to link these libaries?

    I

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔





    The robot is going to lose. Not by much. But when the final score is tallied, flesh and blood will beat the damn monster.
    Adam Smith
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-11-11 10:12
    Just put the Format.java file in folder
    <Javelin Install Path>\lib\stamp\util\text

    (create folders with the above exact names if neccessary)
    Use
    · ·import stamp.util.text.*;
    to use the Format class in your java files.

    Rename the original Uart.java to Uart.org
    and copy the new Uart.java and UartTools.java to folder
    <Javelin Install Path>\lib\stamp\core

    Regards peter
Sign In or Register to comment.