Urgent!!!
philip88822
Posts: 11
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??
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
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.
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 Savage
Parallax Engineering
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.