;; rover1.lsp -- with-wather version of rover.lsp ;; ;; Port A: motor for the left wheel of the Rover ;; Port C: motor for the right wheel of the Rover ;; Port 2: touch sensor for obstacle detection ;; ;; Contributor(s): Taiichi Yuasa (define (forward) (motor :a (motor :c :forward)) (motor :b :off) (play '((:Re4 . 2) (:Do4 . 1) (:Re4 . 1) (:Fa4 . 1) (:Re4 . 1) (:Re4 . 2) (:Fa4 . 2) (:So4 . 1) (:Do5 . 1) (:La4 . 2) (:Re4 . 2))) ) (begin (speed :a (speed :c (speed :b :max-speed))) (wait-until (pressed?)) (wait-until (not (pressed?))) (forward) (with-watcher (((touched? 2) (motor :a (motor :c (motor :b :back))) (sleep 5) (motor (if (= (random 2) 0) :a :c) :forward) (sleep 5) (forward) )) (wait-until (pressed?)) (motor :a (motor :c :off)) ) )