Page 223 - Robot Design Handbook ROBOCON Malaysia 2019
P. 223

The Arduino Mega 2560 is programmed using the Arduino Software (IDE) that runs

                  both online and offline. It is used to write and upload programs to the Arduino board. The
                  Arduino IDE supports the languages of C and C++ using special rules of code structuring.

                  User-written code only requires two basic functions, for starting the sketch and the main
                  programme  loop,  that  are  compiled  and  linked  with  a  programme  stub  main()  into  an

                  executable cyclic executive program with the GNU toolchain, also included with the IDE

                  distribution.

                         For the smooth and steady locomotion of the MR2, a sequence of leg and body

                  motions must be generated. A general programming for a sequence of leg is shown in Figure
                  3,4 and 5.



                  2.3.2 Movement for the MR2 Flow-chart


                                                       START


                                                      LEG_1_UP
                                                      LEG_2_UP

                                                 MOTOR_1_FORWARD
                                                 MOTOR_2_FORWARD


                                                    LEG_1_DOWN
                                                    LEG_2_DOWN

                                                MOTOR_1_BACKWARD
                                                MOTOR_2_BACKWARD
                                                 MOTOR_3_FORWARD
                                                 MOTOR_4_FORWARD

                                                      LEG_3_UP
                                                      LEG_4_UP


                                                MOTOR_3_BACKWARD
                                                MOTOR_4_BACKWARD

                                                    LEG_3_DOWN
                                                    LEG_4_DOWN




                                         Figure 3: Movement for the MR2 flow-chart






                                                            219
   218   219   220   221   222   223   224   225   226   227   228