Shop OBEX P1 Docs P2 Docs Learn Events
Urgent!!! — Parallax Forums

Urgent!!!

philip88822philip88822 Posts: 11
edited 2009-03-09 19:00 in Learn with BlocklyProp
QUESTION:
1.········· Display the message “Please Key in any number from 1 to 9 to make a LEDs. On-Off pattern” in the Debug Terminal and prompt the user to key in a number.· If the input is True , then make a Subroutine called “PATTERN”.· Use the input number as the LEDs On-Off pattern to turn on the corresponding LEDs and then make a time delay ( 2 seconds ). Repeat step 1.

CODE:
SERSTRING VAR BYTE
MAIN:
SERSTING = 0
DEBUG "Please Key in any number from 1 to 9 to make a LEDs. On-Off pattern" ,CR
SERIN 16,16468,100,NODATA [noparse][[/noparse]SERSTRING]

IF ((SERSTRING>=1) AND (SERSTRING<=9) THEN PATTERN
ELSE
NO_PATTERN

PATTERN:
OUTB=SERSTRING<
I DON'T KNOW IF THIS CODE CAN WORK OR NOT
PAUSE 2000
OUTB=0

GOTO MAIN
·NODATA:
GOTO MAIN

CAN THIS CODE WORK??

Comments

  • SRLMSRLM Posts: 5,045
    edited 2009-03-09 16:03
    The best way to determine if it works is to compile and run the code on a suitable board.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-09 16:06
    Please change your subject to be something more meaningful.

    You will also get a more useful answer if you explain a bit more about what you're trying to do. Just copying your homework question doesn't help much.
    Describe what you think you're doing in the section of your code you're questioning. Asking "CAN THIS CODE WORK?" isn't enough. Pretty much any code
    will do something. Whether it does what you would like it to do is another question entirely.
  • philip88822philip88822 Posts: 11
    edited 2009-03-09 16:07
    Yes i know
    but i have no board right now
    i just want to ask if the code "outb=serstring" can work or not
    thx a lot
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-03-09 18:25
    You can use the pencil icon to the top right of your message to change you subject line to something more meaningful.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-09 19:00
    Without a Stamp, all you can do is to compile the program using the Stamp Editor. You've got several syntax errors in what you've posted and the compiler will point them out for you and you can correct them.

    You didn't answer my question about what you mean by "WORK". OUTB happens to be the name of the group of output register bits associated with I/O pins 4-7. Read the BASIC Stamp Manual section on memory allocation and on the OUTPUT statement and the DIRS register. The I/O pins by default become input pins. You have to change them to output pins for the bits of the output register to show up as signals on the I/O pins.
Sign In or Register to comment.