Shop OBEX P1 Docs P2 Docs Learn Events
Scanner Input — Parallax Forums

Scanner Input

R0y4LR0y4L Posts: 23
edited 2010-02-11 00:27 in General Discussion
Hello all Javelin geeks [noparse]:)[/noparse] hehehe

I just got my Javelin Stamp and tryint to familiarise myself with it. I have to say its very different from Basic Stamp. I would like to know is there a way of getting user's input? I have worked out myself that Scanner class does not work. lol.
Oh yeah and another thing. Where could I find information about all classes and all imports that are available for Javelin Stamp cause I'd like to control my servos somehow.

Thank you all

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit: www.vbnoobs.co.uk

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2010-02-09 20:40
    The manual is a good place to start, ch. 9 I think covers the core classes and
    Virtual Peripherals (including PWM for servo control).

    To get input you can use Terminal.getChar().
    Most used import classes are in the core folder, use

    import stamp.core.*;

    regards peter
  • R0y4LR0y4L Posts: 23
    edited 2010-02-10 16:48
    Hi peter, I have found some information about the Terminal.getChar() and I was wondering if you could help me. I have this Java program that I found for Javelin. The problem is that when I download it onto my robot and the Javelin Terminal loads i do not receive any echo from Javelin. Any idea what could be wrong?

    much appreciated.

    Reads characters and converts them to uppercase. Remember that the messages from
    Javelin window can be used for bi-directional communication. After running Program Listing 3.11, simply click the
    transmit terminal. Next, try typing a few characters. The characters will appear in the transmit terminal, and they will
    also be echoed in the messages window above. Immediately after each echoed character, you will also see the Javelin
    Stamp’s converted character.



    import stamp.core.*;
    public class Capitalize {
    public static void main() {
    char c;
    System.out.println("Begin");
    do {
    c=Terminal.getChar(); // Get character from keyboard
    if (c>='a' && c<='z') { // Test if it’s not a capital
    int tmp=(int)c; // Create and assign ‘tmp’ the char c as an int
    tmp=tmp-32; // Convert lower case to upper by subtracting 32
    c=(char)tmp; // Assign int tmp into char c
    } // end if
    System.out.print(c); // Output character
    } while (c!=27); // Do the above until escape key is pressed
    } // end main
    } // end Capitalize

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Visit: www.vbnoobs.co.uk
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2010-02-11 00:27
    If you use a Board of Education USB, please read this thread
    http://forums.parallax.com/showthread.php?p=656527


    You must type characters in the 1 line send text field. If you type in the
    large terminal window, nothing is sent to the javelin.
    Also, better to use Enter (Carriage return) rather than ESC.
    I am not sure ESC gets transmitted, but CR is (test for CR [noparse][[/noparse]0x0D]·or LF [noparse][[/noparse]0x0A]).
    It may be that CR gets translated to newline (which is 0x0A).


    regards peter
Sign In or Register to comment.