Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Hi every time I try to run the following program:

L=-1
WHILE L
    OPEN "tty.usbserial-FTG7QLFS:300,N,8,1,CS0,DS" AS#1
        J=63
    MENU:   PRINT
        PRINT
        PRINT
        PRINT
        PRINT
        PRINT

    PRINT "WAITING FOR KEYSTROKE COMMAND"
        PRINT "TYPE:"
        PRINT "  C-CLOSE SHUTTER"
        PRINT "  O-OPEN SHUTTER"
        PRINT "  R-RESET CONTROL"
        PRINT "  Q-TERMINATE PROGRAM"
        PRINT
        PRINT

    START: A$ = INKEY$
    IF A$ = "O" THEN
        PRINT #1,CHR$(J+1);
        PRINT "SHUTTER OPEN COMMAND SENT"
        GOSUB TIMEOUT
        GOTO MENU
        ELSEIF A$ = "C" THEN
            PRINT #1,CHR$(J+2);
            PRINT "SHUTTER CLOSE COMMAND SENT"
            GOSUB TIMEOUT
            GOTO MENU
        ELSEIF A$ = "R" THE
            PRINT #1,CHR$(J+3);
            PRINT "CONTROL RESET COMMAND SENT"
            GOSUB TIMEOUT
            GOTO MENU
        ELSEIF A$ = "Q" THEN
            L = 0
            PRINT "PROGRAM TERMINATED"
        ELSE GOTO START
    END IF
WEND
END
TIMEOUT:    FOR I=1 TO 100:NEXT I
             CLS 0
             RETURN

I get the following error "syntax error, missing symbol in line 6", but at line 6 there is only a print statement so I can't figure out what I'm missing. I'm running the program through Chipmunk Basic on Mac OS X.

Thanks

share|improve this question

1 Answer 1

I guess

OPEN "tty.usbserial-FTG7QLFS:300,N,8,1,CS0,DS" AS#1

is missing a file access mode. Maybe the compiler is looking for such tokens without success and gives up in the next lines.

The Chipmunk BASIC docs say:

open STRINGEXPR for { input|output|append } as # FNUM
-- or --
open STRINGEXPR for random as # FNUM len = VAL

See http://anoved.net/cbasdox/statements.html#open

I don't really know Chipmunk BASIC but also in other BASIC dialects (QBasic, FreeBASIC, VisualBASIC Classic, ...) you have to state for what actions you want to open your file.

Examples FreeBASIC:

OPEN SomeFile FOR INPUT AS #1     ' input (read-only)
OPEN OtherFile FOR OUTPUT AS #2   ' write (replace existing file)
OPEN FooFile FOR BINARY AS #3     ' binary (read + write)

It's like specifying "r", "r+", ... when using fopen in C-ish languages.

share|improve this answer
    
Maybe it's even as simple as that he doesn't have a 'space' in there... AS#1 maybe should be AS #1 –  Kat Cox Jul 15 '13 at 19:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.