#lang scheme/base (require "pic18.ss" ;; PIC18 compiler in a namespace scheme/control ;; for 'prompt so errors don't kill the REPL readline/rep) ;; readline command line editing (provide repl) (define (repl) ;; Serial port configuration: device baudrate. On OSX (possibly also ;; other BSDs), use the binary cau device instead of tty. (unless (current-console) (current-console '("/dev/ttyUSB0" 9600) ;; '("/dev/ttyS0" 9600) )) (printf "\nConsole at ~a\n" (current-console)) (forth-command "ping") (printf "Press ctrl-D to quit.\n") (file-stream-buffer-mode (current-output-port) 'none) (let loop () (printf "OK\n") (let ((cmd (read-line))) (unless (eof-object? cmd) (prompt (forth-command cmd)) (loop)))) (printf "Dada.\n"))