Page 104 - 人工智能——为机器植入智慧
P. 104

人工智能——为机器植入智慧



                       程序流程:












































                                                         图 8-18



                       参考程序:


                         #pragma config(Sensor, S1,     light,          sensorLightInactive)
                         #pragma config(Sensor, S2,     touchl,         sensorTouch)
                         #pragma config(Sensor, S3,     touchr,         sensorTouch)
                         #pragma config(Sensor, S4,     sound,          sensorSoundDB)
                         #pragma config(Motor,  motorA,    A,     tmotorNXT, PIDControl, encoder)

                         task main()
                         { while(1)
                             {nxtDisplayTextLine(4, "sound=%dDB",SensorValue[sound]);
                                    if(SensorValue[sound]>50 && SensorValue[touchl]==0)




             90
   99   100   101   102   103   104   105   106   107   108   109