Presentation is loading. Please wait.

Presentation is loading. Please wait.

機器人課程實作教學 LEGO機器人使用ROBOTC.

Similar presentations


Presentation on theme: "機器人課程實作教學 LEGO機器人使用ROBOTC."— Presentation transcript:

1 機器人課程實作教學 LEGO機器人使用ROBOTC

2 ROBOTC 簡介 ROBOTC機器人程式開發環境是由卡內基美隆大學(Carnegie Mellon)所開發,並且開發出許多機器人教育所可以使用的套件。例如:VEX Cortex、TETRIX等可作為機器人教育所使用的套件。 ROBOTC教學網站&卡內基美隆大學機器人學院。 ROBOTC適用包含LEGO及Arduino等多種系統。

3 ROBOTC 環境介紹 ROBOTC操作環境

4 ROBOTC & LEGO LEGO韌體更新流程-1

5 ROBOTC & LEGO LEGO韌體更新流程-2

6 ROBOTC & LEGO LEGO韌體更新流程-3

7 ROBOTC & LEGO LEGO韌體更新流程-4

8 ROBOTC & LEGO 藍芽傳輸介面 設定-1

9 ROBOTC & LEGO 藍芽傳輸介面 設定-2

10 ROBOTC & LEGO 藍芽傳輸介面 設定-3

11 ROBOTC & LEGO 藍芽傳輸介面 設定-4

12 ROBOTC & LEGO 藍芽傳輸介面 設定-5

13 ROBOTC & LEGO 藍芽傳輸介面 測試

14 感測器與連接埠設定

15 感測器與連接埠設定 #pragma config(Sensor, S1, Touch, sensorTouch)
#pragma config(Sensor, S2, Sound, sensorSoundDB) #pragma config(Sensor, S3, Light, sensorLightActive) #pragma config(Sensor, S4, Sonar, sensorSONAR) const tSensors lightSensor = (tSensors) S3;

16 ROBOTC程式編寫 感測器實作-Touch Sensor
const tSensors touchSensor = (tSensors) S1; task main() { while(SensorValue(touchSensor) == 0) motor[motorC] = 100; motor[motorB] = 100; } motor[motorC] = -30; motor[motorB] = -75; wait1Msec(1500);

17 ROBOTC程式編寫 感測器實作-Sound Sensor
#pragma config(Sensor, S2, soundSensor, sensorSoundDB) task main() { wait1Msec(1000); while(SensorValue(soundSensor) < 70) motor[motorC] = 75; motor[motorB] = 75; } motor[motorC] = 0; motor[motorB] = 0;

18 ROBOTC程式編寫 感測器實作- Sound Sensor -2
#pragma config(Sensor, S2, soundSensor, sensorSoundDB) task main() { wait1Msec(1000); while(true) motor[motorB] = SensorValue[soundSensor]; motor[motorC] = SensorValue[soundSensor]; }

19 ROBOTC程式編寫 感測器實作-Light Sensor
#pragma config(Sensor, S3, lightSensor, sensorLightActive) task main() { wait1Msec(50); while(true) if(SensorValue[lightSensor] < 45) motor[motorB] = 60; motor[motorC] = 20; } else motor[motorB] = 20; motor[motorC] = 60;

20 ROBOTC程式編寫 感測器實作-Sonar Sensor
#pragma config(Sensor, S4, sonarSensor, sensorSONAR) task main() { int distance_in_cm = 20; while(SensorValue[sonarSensor] > distance_in_cm) motor[motorB] = 75; motor[motorC] = 75; } motor[motorB] = 0; motor[motorC] = 0;

21 ROBOTC程式編寫 動力輸出控制-1 #pragma config(Sensor, S1, touch, sensorTouch)
#pragma config(Sensor, S3, lightSensor, sensorLightActive) task main() { while(SensorValue(touch) == 0) wait1Msec(50); if(SensorValue[lightSensor] < 45) motor[motorB] = 60; motor[motorC] = 20; } else motor[motorB] = 20; motor[motorC] = 60;

22 ROBOTC程式編寫 動力輸出控制-2 #pragma config(Sensor, S1, touch, sensorTouch)
#pragma config(Sensor, S3, lightSensor, sensorLightActive) #pragma config(Sensor, S4, Sonar, sensorSONAR) task main() { while(SensorValue(Sonar)>20) wait1Msec(50); if(SensorValue[lightSensor] < 45) motor[motorB] = 60; motor[motorC] = 20; } else motor[motorB] = 20; motor[motorC] = 60;

23 Q &A

24 謝謝指教


Download ppt "機器人課程實作教學 LEGO機器人使用ROBOTC."

Similar presentations


Ads by Google