![]() |
| ||||||||||
| HOMESUBSCRIBERENEWGIVE A GIFTFREE TRIAL ISSUECUSTOMER SERVICEPAY BILLCURRENT ISSUE |
DEMO SOURCE CODE FOR SCRIBBLER HACK SIDEBAR ' {$STAMP BS2} ' distance VAR Word trigger CON 10 convfac CON 74 ' use inches MotorRight PIN 12 INPUT 7
'--------------------------------------------- main:
IF (stall = 1) THEN IF (distance < 7) THEN ‘ if an obstacle is very close ELSEIF (distance < 15) THEN ‘ hard turn ELSEIF (distance < 18) THEN ‘medium turn ELSEIF (distance < 20) THEN ‘shallow turn PULSOUT MotorRight, 2800 ELSE ‘drive straight forward ENDIF
GOSUB ultrasonic ‘read the ultrasonic sensor
ultrasonic: ‘ code from Acroname PULSOUT INIT,5 ' 10us init pulse RETURN Based on example code from Acroname (http://acroname.com/robotics/info/examples/srf04-1/srf04-1.html) |
|
Site Guide home | publication schedule | writers' guidelines | contact Robot | links to other robot sites Get Robot subscribe | give a gift | renew | customer service | buy back issues | pay bill © 2008 Maplegate Media Group, 650 Danbury Road, Ridgefield, CT 06877 Tel: (203) 431-7787 | Email: editor@botmag.com |