ryansuchocki / microscheme

A Scheme subset for Atmel microcontrollers.
http://ryansuchocki.github.io/microscheme/
MIT License
300 stars 20 forks source link

Cannot set pin 1 low #10

Closed technomancy closed 9 years ago

technomancy commented 9 years ago
(define pins (list 0 1 2 3))

(for-each output pins)
(for-each low pins)

Using a multimeter tells me that pin 1 remains high.

This is on an astar micro, which is the same chip as the leonardo. This led me to speculate that perhaps the arduino-ports or arduino-pins mapping in stdlib.ms was incorrect. However, if I load this program onto an Uno, I get both 0 and 1 remaining high.

ryansuchocki commented 9 years ago

I think this is due to interference from the UART. (i,e. tx/rx on pins 0/1)

On latest master, I've moved the UART initialisation to an explicit primitive (serial-init). The pins should be fine if that primitive isn't called.

Does this fix it?

technomancy commented 9 years ago

Aha; that would make sense. Just tested and confirmed this fixes the problem on both my Uno and my A-Star. Thanks!'