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

Amphibionics 05  3/24/03  8:44 AM  Page 171
                                       Chapter 5 / Serpentronic: Build Your Own Robotic Snake
                        led_left         VAR portA.2
                                                                                   ircal-serpent.bas
                        led_right       VAR portA.3                                PROGRAM 5.3
                                                                                   program listing
                        ir_input         VAR portB.1                               (continued)
                        low led_left
                        low led_right
                        ir_cal:


                            If ir_input = 0 then
                              high led_left
                              high led_right
                            endif
                              low led_left
                              low led_right


                        goto ir_cal

                        end



                        :1000000001288316850103308600831205118316AB                PROGRAM 5.4
                        :1000100005118312851183168511831264008618D9                ircal-serpent.hex file
                        :100020001928051583160511831285158316851168                listing
                        :10003000831205118316051183128511831685110C
                        :0800400083120E286300222840
                        :02400E00F53F7C
                        :00000001FF


                        Motion Control
                        The next task will be to coordinate the movement of each of the
                        snake’s body segments to achieve locomotion. To produce a for-
                        ward movement, our snake will move its body in a sine wave pat-
                        tern vertically, with a slight side to side movement of the horizon-
                        tal segments. The use of servos makes this sort of programming

                                                                                                 171
   187   188   189   190   191   192   193   194   195   196   197