Page 113 - ArduinoและPOP-BOT
P. 113

 113






                 /*******************************************************************************
                 * POP-BOT V1.0
                 * Filename : GP2D120_LCD.pde
                 * Show Data reading from GP2D120 on SLCD
                 ********************************************************************************/
                 // *** in this example SLCD connected to pin 16 ***
                 // *** in this example GP2D120 connected to pin A5 ***
                 #include <popbot.h>  // Include Library for POP-BOT
                 #include <gp2d120_lib.h>
                 int dist;
                 void setup()
                 {
                 }
                 void loop()
                 {
                   dist = getdist(5);
                   lcd(“Dist: %d cm   “,dist);
                   sleep(200);
                 }

                 /******************************************************************************/

               โปรแกรมที่  A7-1 ไฟล  GP2D120_LCD.pde โปรแกรมภาษา C ของ Arduino สํ าหรั บทดสอบการติ ดต อ

               เพื่ ออ านค าจากโมดู ลวั ดระยะทาง GP2D120 แสดงผลผ านโมดู ล SLCD16x2 ของหุ นยนต  POP-BOT
   108   109   110   111   112   113   114   115   116   117   118