Page 134 - Amphibionics : Build Your Own Biologically Inspired Robot
P. 134

Amphibionics 04  3/24/03  8:24 AM  Page 113
                        endif
                                                                                   frogbotic.bas program
                                                                                   listing (continued)
                        left:            Chapter 4 / Frogbotic: Build Your Own Robotic Frog PROGRAM 4.5
                        if switch_l = 1 then
                          high led_l
                          servo_pos_l = 152
                          gosub left_servo
                        else
                          low led_l
                          servo_pos_l = 100
                          gosub left_servo
                        endif

                        if switch_l = 1 and switch_r = 1 then
                          for temp1 = 1 to 6
                          servo_pos_l = 150
                          servo_pos_r = 159
                          gosub both_servo
                          next temp1
                          servo_pos_l = 100
                          servo_pos_r = 200
                          gosub both_servo
                        endif

                        goto right

                        '------------------------------------------------------------------------------------------------------------------------------
                        ' subroutines to set servos

                        both_servo:
                            for timer1 = 1 to 15
                            pulsout servo_l,servo_pos_l
                            pulsout servo_r,servo_pos_r
                            pause 6
                            next timer1
                        return




                                                                                                 113
   129   130   131   132   133   134   135   136   137   138   139