Download presentation
Presentation is loading. Please wait.
1
LEGO機器人使用ROBOTC 國立岡山高中 郭銘哲
機器人課程實作課程 LEGO機器人使用ROBOTC 國立岡山高中 郭銘哲
2
ROBOTC 簡介 ROBOTC機器人程式開發環境是由卡內基美隆大學(Carnegie Mellon)所開發,並且開發出許多機器人教育所可以使用的套件。例如:VEX Cortex、TETRIX等可作為機器人教育所使用的套件。 ROBOTC教學網站&卡內基美隆大學機器人學院。 ROBOTC適用包含LEGO及Arduino等多種系統。
3
取得ROBOTC ROBOTC介紹網站 機器人學院 ROBOTC購買網站
4
ROBOTC 環境介紹 ROBOTC操作環境
5
ROBOTC & LEGO LEGO韌體更新流程-1
6
ROBOTC & LEGO LEGO韌體更新流程-2
7
ROBOTC & LEGO LEGO韌體更新流程-3
8
ROBOTC & LEGO LEGO韌體更新流程-4
9
ROBOTC & LEGO 藍芽傳輸介面 設定-1
10
ROBOTC & LEGO 藍芽傳輸介面 設定-2
11
ROBOTC & LEGO 藍芽傳輸介面 設定-3
12
ROBOTC & LEGO 藍芽傳輸介面 設定-4
13
ROBOTC & LEGO 藍芽傳輸介面 設定-5
14
ROBOTC & LEGO 藍芽傳輸介面 測試
15
感測器與連接埠設定
16
感測器與連接埠設定 #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;
17
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);
18
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;
19
ROBOTC程式編寫 感測器實作- Sound Sensor -2
#pragma config(Sensor, S2, soundSensor, sensorSoundDB) task main() { wait1Msec(1000); while(true) motor[motorB] = SensorValue[soundSensor]; motor[motorC] = SensorValue[soundSensor]; }
20
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;
21
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;
22
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;
23
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;
24
ROBOTC ROBOTC & NXT ROBOTC & MRDS(RDS4) ROBOTC & LabVIEW
25
Q &A
26
謝謝指教
Similar presentations