Page 333 - Robots Androids and Animatrons : 12 Incredible Projects You Can Build
P. 333

312




                                      16.15 Electrically operated three-way air valve


                        BASIC program

                                The BASIC program is short and simple. After finding the printer
                                port address, the following lines control the valve of pin 2:
                                5 REM Solenoid Air Valve Controller
                                10 REM John Iovine
                                15 REM Find Printer Port Address
                                20 DEF SEG = 0
                                25 a = (PEEK(1032) + 256 * PEEK(1033))
                                30 REM Next line activates the air muscle
                                35 OUT a,1
                                40 REM Next line deactivates the air muscle
                                45 OUT a,0
                                By bringing the DB25 pin 2 high, the air valve is opened allowing
                                air pressure to the air muscle. Bringing pin 2 low, closes the air
                                valve to the muscle and vents the air from the air muscle.

                                                       Team LRN
            Chapter sixteen
   328   329   330   331   332   333   334   335   336   337   338