'ShoeController 'Right Nike boot #PicAxe14M2 #no_data '416 bytes out of 2048 'Transmitter 1000us trigger fully out 'Transmitter 1500us trigger at auto centre 'Transmitter 2000us trigger fully in 'Receiver FailSafe set with trigger at auto centre =1500us 'Receiver trigger output is Channel #2 'program servo resoution in 10us units => 100=1000us symbol flypulse =180 '=>1800us sertxd("Flying Nike boot Right, PicAxe14M2 2013June17 DB",cr) 'pins symbol rxin =C.0 'servo pulse from Rx symbol SRs =B.5 'Servo Right Shoulder symbol SRe =B.4 'Servo Right Elbow symbol SLs =B.3 'Servo Left Shoulder symbol SLe =B.2 'Servo Left Elbow symbol LED =B.1 'debug LED 'wing constants symbol RWu =185 'Right Wing Up (Shoulder) symbol RWc =147 'Right Wing Centre (Shoulder) symbol RWd =110 'Right Wing Down (Shoulder) symbol RWf =105 'Right Wing Folded (Shoulder) symbol RWi =85 'Right Wing In (Elbow) symbol RWo =180 'Right Wing Out (Elbow) symbol LWu =110 'Left Wing Up (Shoulder) symbol LWc =147 'Left Wing Centre (Shoulder) symbol LWd =185 'Left Wing Down (Shoulder) symbol LWf =205 'Left Wing Folded (Shoulder) symbol LWi =200 'Left Wing In (Elbow) symbol LWo =125 'Left Wing Out (Elbow) symbol Sframe =15 'W0 symbol f_flags =b0 symbol f_SRs =bit0 '1=> at To symbol f_SLs =bit1 '1=> at To symbol f_SRe =bit2 '1=> at To symbol f_SLe =bit3 '1=> at To ' b1 'W1 symbol RSat =b2 'Right Shoulder symbol REat =b3 'Right Elbow 'W2 symbol LSat =b4 'Left Shoulder symbol LEat =b5 'Left Elbow 'W3 symbol RSto =b6 symbol REto =b7 'W4 symbol LSto =b8 symbol LEto =b9 'W5 symbol i =b10 'for next counter symbol speed=b11 'W6 symbol ctrlplse =W6 ' b12 ' b13 ' 'W13 ' b26 ' b27 'setup '----- 'wings center,out 'with chassis on table ' Rtip 120mm up ' Ltip 132mm up 'with chassis in shoe on table ' Rtip 155mm up ' Ltip 130mm up Init: 'start with wings In and Down ' RSat =RWc 'setupwings 120,155 ' REat =RWo 'setupwings ' LSat =LWc 'setupwings 132,130 ' LEat =LWo 'setupwings RSat =RWf'd REat =RWi LSat =LWf'd LEat =LWi high LED speed =3 sertxd("Init") Start: 'sertxd("S") toggle LED gosub tellservos pulsin rxin,1,ctrlplse if ctrlplseflypulse then Fly 'quit gliding if flying next i 'if not flying then Fold WFold: 'Wings Fold gosub WingsIn gosub FlapUp 'figit gosub FlapDown GOTO Init FlapUp: sertxd("U") RSto =RWu LSto =LWu speed =6 'faster on upbeat GOTO Flap FlapDown: sertxd("D") RSto =RWd LSto =LWd speed =3 GOTO Flap FlapCentre: sertxd("C") RSto =RWc LSto =LWc speed =3 GOTO Flap Flap: f_SRs =0 f_SLs =0 if RSat>RSto then RSat =RSat -speed min RSto else RSat =RSat +speed max RSto endif if LSat>LSto then LSat =LSat -speed min LSto else LSat =LSat +speed max LSto endif if RSat=RSto then f_SRs =1 endif if LSat=LSto then f_SLs =1 endif gosub tellservos if f_SRs<>1 or f_SLs<>1 then Flap RETURN WingsIn: 'sertxd("I") REto =RWi LEto =LWi GOTO Wings WingsOut: 'sertxd("O") REto =RWo LEto =LWo GOTO Wings Wings: f_SRe =0 f_SLe =0 if REat>REto then REat =REat -speed min REto else REat =REat +speed max REto endif if LEat>LEto then LEat =LEat -speed min LEto else LEat =LEat +speed max LEto endif if REat=REto then f_SRe =1 endif if LEat=LEto then f_SLe =1 endif gosub tellservos if f_SRe<>1 or f_SLe<>1 then Wings RETURN tellservos: pulsout SRs,RSat pulsout SRe,REat pulsout SLs,LSat pulsout SLe,LEat pause Sframe RETURN