|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
use Libraries.Robots.BirdBrain.Finch class Main action Main Finch finch finch:Pause(2) say "Warning, stay clear, Finch is Evaluating the magnetic field" finch:SetTail("All",100,0,100) finch:SetBeak(100,0,100) finch:SetMotors(100,-100) finch:Pause(2) finch:SetMotors(100,-100) finch:Pause(2) finch:StopAll() say" Attention, Attention. Magnetic North Found, Compass is ready." finch:Pause(2) finch:SetMotors(2,-2) repeat until finch:GetButton("A") if finch:GetCompass() >=340 finch:Output("N") finch:SetTail("All",0,0,100) finch:SetBeak(0,0,100) say "True North" finch:Stop() finch:Output("N") finch:Output("N") repeat 5 times finch:PlayNote(72,0.3) finch:PlayNote(100,0.3) finch:Pause(0.2) end finch:Output("N") finch:SetMotors(2,-2) elseif finch:GetCompass() >=300 or finch:GetCompass() <=45 finch:Output("N") finch:SetTail("All",0,0,100) finch:SetBeak(0,0,100) say "North" elseif finch:GetCompass() >=46 and finch:GetCompass() <=135 finch:Output("E") finch:SetTail("All",50,100,0) finch:SetBeak(50,100,0) say "East" elseif finch:GetCompass() >=136 and finch:GetCompass() <=225 finch:Output("S") finch:SetTail("All",100,0,0) finch:SetBeak(100,0,0) say "south" elseif finch:GetCompass() >=226 and finch:GetCompass() <=299 finch:Output("W") finch:SetTail("All",0,100,25) finch:SetBeak(0,100,25) say "west" end output finch:GetCompass() finch:Pause(0.2) finch:SetMotors(2,-2) finch:Pause(0.2) end finch:Stop() finch:StopAll() finch:SetTail("All",100,0,0) finch:SetBeak(100,0,0) finch:Pause(2) finch:SetMotors(100,-100) finch:Pause(3) finch:SetMotors(-100,-5) finch:Pause(3) finch:StopAll() finch:Disconnect() end end
|
|