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

Amphibionics 04  3/24/03  8:24 AM  Page 112
                                                       Amphibionics
                      PROGRAM 4.5
                      frogbotic.bas program
                                          servo_l       VAR PORTB.6
                      listing (continued)  servo_r       VAR PORTB.5
                                          switch_r      VAR PORTA.4
                                          switch_l      VAR PORTA.3
                                          led_l            VAR PORTB.1
                                          led_r           VAR PORTB.0
                                          piezo           VAR PORTB.4
                                          low servo_l
                                          low servo_r

                                          '------------------------------------------------------------------------------------------------------------------------------

                                          start:

                                          for temp1 = 1 to 5
                                            SOUND piezo, [80,4,100,2]
                                            low led_l
                                            low led_r
                                            pause 50
                                            high led_l
                                            high led_r
                                            next temp1
                                            SOUND piezo, [100,4,120,2,80,2,90,2]
                                            low led_l
                                            low led_r


                                          right:

                                          if switch_r = 1 then
                                            high led_r
                                            servo_pos_r = 158
                                            gosub right_servo
                                          else
                                            low led_r
                                            servo_pos_r = 200
                                            gosub right_servo


                      112
   128   129   130   131   132   133   134   135   136   137   138