fl { Distance sensor by using GP2Y0A21 MCP3204/MCP3208(12bit serial A/D converter) PropForth5.5 2013/04/07 23:25:29 GP2Y0A21 MCP3204 ---- --------- | V0 | --------|CH0 Vdd|-- +5V GND--| GND| --|CH1 Vref|-- +5V +5V--| Vcc| --|CH2 AGND|-- GND ---- --|CH3 CLK|-- P2 --|NC Dout|-- 2.2kohm --| --|NC Din|-- ----------|-- P1 GND--|DGND _CS|-- P0 --------- } : distance init_mcp begin 0 d10 0 do \ ( channel single cs ) 0 1 _cs a_mcp320* + loop d10 u/ . fkey? swap drop until ; : test init_mcp begin 0 1 _cs a_mcp320* . cr fkey? swap drop until ;