资源描述:
《工程设计实践程序》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、'{$STAMPBS2}'{$PBASIC2.5}pulseCountVARBytegoVARWord'-----[MainRoutine]-----------FORgo=1TO50'张开爪子PULSOUT0,950PAUSE20NEXTFORgo=1TO40'走过绿色区域的黑线PULSOUT13,690PULSOUT12,819PAUSE20NEXTDO'直走走到中点IF(IN14=0)AND(IN15=0)THENGOSUBforwardELSEIF(IN14=0)THENGOSUBleftEL
2、SEIF(IN15=0)THENGOSUBrightELSEGOSUBstopping_PulseEXITENDIFLOOPFORgo=1TO13'向前走一点PULSOUT13,690PULSOUT12,819PAUSE20NEXTFORgo=1TO40'右转90度PULSOUT13,770PULSOUT12,775PAUSE20NEXTDO'走到E黄色IF(IN14=0)AND(IN15=0)THENGOSUBforwardELSEIF(IN14=0)THENGOSUBleftELSEIF(IN15
3、=0)THENGOSUBrightELSEGOSUBstopping_PulseEXITENDIFLOOPUNTIL(IN2=0)'抓住黄色木块FORgo=1TO100PULSOUT0,600PAUSE20NEXTFORgo=1TO75'转150度PULSOUT13,770PULSOUT12,770PAUSE20NEXTFORgo=1TO90'夹住直走一段PULSOUT13,650PULSOUT12,850PAUSE20NEXTDOPULSOUT13,690PULSOUT12,819PAUSE20LO
4、OPUNTIL(IN6=1)FORgo=1TO12'前进一段PULSOUT13,690PULSOUT12,819PAUSE20NEXTFORgo=1TO38'右转PULSOUT13,750PULSOUT12,819PAUSE20NEXTDOIF(IN14=0)AND(IN15=0)THENGOSUBforwardELSEIF(IN14=0)THENGOSUBleftELSEIF(IN15=0)THENGOSUBrightELSEGOSUBstopping_PulseEXITENDIFLOOPUNTIL
5、(IN6=1)FORgo=1TO10'停一下PULSOUT13,750PULSOUT12,750PAUSE20NEXTFORgo=1TO16'前进PULSOUT13,690PULSOUT12,819PAUSE40NEXTFORgo=1TO10'停一下PULSOUT13,750PULSOUT12,750PAUSE40NEXTFORgo=1TO50'放黄色PULSOUT0,950PAUSE20NEXTFORgo=1TO42'后退PULSOUT13,820PULSOUT12,689PAUSE20NEXTFO
6、Rgo=1TO16'右转PULSOUT13,770PULSOUT12,770PAUSE20NEXTDO'前进PULSOUT13,690PULSOUT12,819PAUSE20LOOPUNTIL(IN6=1)FORgo=1TO10'前进一段PULSOUT13,690PULSOUT12,819PAUSE20NEXTFORgo=1TO35'右转PULSOUT13,750PULSOUT12,819PAUSE20NEXTDO'走到红色IF(IN14=0)AND(IN15=0)THENGOSUBforwardEL
7、SEIF(IN14=0)THENGOSUBleftELSEIF(IN15=0)THENGOSUBrightELSEGOSUBstopping_PulseEXITENDIFLOOPUNTIL(IN2=0)FORgo=1TO100'抓住红色木块PULSOUT0,650PAUSE20NEXTFORgo=1TO55'左转一点PULSOUT13,690PULSOUT12,750PAUSE20NEXTFORgo=1TO70'前进PULSOUT13,690PULSOUT12,819PAUSE20NEXTDOPULS
8、OUT13,690PULSOUT12,819PAUSE20LOOPUNTIL(IN6=1)FORgo=1TO12'前进一段PULSOUT13,690PULSOUT12,819PAUSE20NEXTFORgo=1TO38'右转PULSOUT13,750PULSOUT12,819PAUSE20NEXTDOIF(IN14=0)AND(IN15=0)THENGOSUBforwardELSEIF(IN14=0)THENGOSUBleftELSEIF(IN15=0)