You are on page 1of 3
Sensing, Decisions and Counting Semantic Activity - What If Objective Use the input from a sensor with the IF command in a BASIC program. Introduction The workca Is fitted with two infrared sensor, The sensor on the conveyor belt is called a Part Sensor - it senses when a part breaks the beam. ‘The sensor on the parts dispenser is set up to monitor if a piece has got 2 hole in itor not, This is called @ Hole Sensor. ‘You are going to write a program Using the IF command to detect if parts have a hole in and display an appropriate message. Equipment + Computer + Robot Control software @ (includes work-cell simulator) Method ete For any ofthe instructions that follow, needed used the Hel. we tet cal sora @ ena creck te Radot mens is set to Control Simulation. Ensure the Work-ell naire Un obot sa the stat poston, Place a large part into dispenser A Laos thepecarm ced parte ole censocte~ight-eli on the fl nk andl “Save Tego As. This the fat ‘edion ofa program, Te wil pK up 4 pare and move ht the ole sanor You wil add secon tothe progam © {est the par to see rt hes 3 le oo '@1 How many command lines does the ‘Part to Hole Sensor’ program have? (Coter your answer as 8 number and press rein) @ “it own ene oman. The neh hse death prt ae i Test for hole IF HOLE_SENSOR_ON ; If there is a hole PRINT "There is a hole in this part. WAIT 4000 GOTO Here ENDIF i If there is not a hole PRINT "There is not a hole in this part." WAIT 4000 LABEL Here > Setageesetes pees rey reat or te pao rem ue Say the part has 3 hol The ("mark Ines ara commants ena shoul Rep you to understand what he programs cans ‘The IF HOLE_SENSOR_ON command ine wil heck f here sa hoe in he par, Whe tii tue (there 3 ole) the command Ines afethe IF commas wl be eared Out- nent IF HOLE_SENSOR_ON command ine notte (here no hole), he command Ines afer the {Sisal be Sypeaad tthe ADM conan wane, aden ne eng cra ne wil be @ ere retest pean, andar ge par nape Qe eer erat ate oe rote (@2 How many ofthe four large parts had holes In them? 0000 Compare ths secon ofa owchart with the par ofthe program you have just add, You should netic hat Sons decison box Yes Is hole sensor on? PRINT "There is a hole in the part” PRINT "There is not a hole in the part” WAIT 4000 war 4000 t GOTO here LABEL here: +—_______| fun the program again and waten the computer stepping tough the command ines. Remember, wen the part asa holaim than th IF HOLE SENSOR ON line le true. A true ie il cary out oe commands unt the ENDIF Ines reeche. Por afte ine (Oe par docs nt have 9 Pale Inf), those commangs se bypassed @ rete Fane conan danse xan of he ech cman (loc ere to record your dese, QS Inthe Howcnart, what type of box has the pl O_ Ststystop box Opstrovtput box Operation box ° Decision box Q4 The following lea ection of a program lke the one you hav Dart number t have hole Init? ; Test for hole IP HOLE_SENSOR_ON PRINT “This is part number 1" WAIT 4000 Goro Here ENDIF PRINT "This is part number 2 WAIT 4000 LABEL Here Oo OM @ ev eh in ss re sr ‘command tine F HOLE_ SENSOR OFF cen be ued in» rogram i sinlar may When the pat des not have & hoe nt then ye IF HOLE. SENSOR_OFF command Ine sve It il cary out the conmane nes url Ne ENDIF command erenched io output only» message about te pat having ma hae. When the IF HOLE_SENSOR-OFF command lines fase (the par has 3 al) those comma Ines are ayoassed, anc ‘eesage absutthe por having» Pole O30 ay your ocopram tous the commandline IF HOLE_SENSOR_OFF un your program and cneck I does “oreclyientty pre nino eles ana those wah Pole: 125 Would the following command lines correcty Identity 9 part with no hole? IF HOLE_SENSOR_OFF PRINT "This part has a hole. GoTo Bypass ENDIF PRINT "This part has no hole." LABEL Bypass oO Ms ON @ Se vor sna te Wo SENSOR OF coma i (lk neve to ata your progam, @ Peron rH seo oF nme cen © ertee cette

You might also like