114
edits
No edit summary |
No edit summary |
||
Line 48: | Line 48: | ||
1.09 | 1.09 | ||
Inspiration part: 老师发的动物图 | Inspiration part: 老师发的动物图 | ||
[[File:exambota1.png|400px]] | [[File:exambota1.png|400px]] | ||
Line 66: | Line 67: | ||
2.05 | 2.05 | ||
模型结构part:电机 绳子 细节 实验图 | 模型结构part:电机 绳子 细节 实验图 | ||
[[File:bota-1.jpg|400px]][[File:bota-2.jpeg|400px]][[File:bota-3.jpeg|400px]][[File:bota-4.jpeg|400px]][[File:ota-5.jpg|400px]] | [[File:bota-1.jpg|400px]][[File:bota-2.jpeg|400px]][[File:bota-3.jpeg|400px]][[File:bota-4.jpeg|400px]][[File:ota-5.jpg|400px]] | ||
Line 73: | Line 75: | ||
3.12 | 3.12 | ||
Arduino线路图 电路细节 | Arduino线路图 电路细节 | ||
[[File:bota-6.jpg|400px]][[File:bota-7.jpeg|400px]][[File:bota-8.jpeg|400px]] | [[File:bota-6.jpg|400px]][[File:bota-7.jpeg|400px]][[File:bota-8.jpeg|400px]] | ||
Below: The Code for controlling the motor's speed and direction, via the ultrasonic sensor. The sensor outputs a range of distance values, and by continuously detecting the distance it can predict the mode of visitor's movement. | Below: The Code for controlling the motor's speed and direction, via the ultrasonic sensor. The sensor outputs a range of distance values, and by continuously detecting the distance it can predict the mode of visitor's movement. | ||
int SNUM[3] ;//定义3个传感器,从SNUM[0]-SNUM[2]为从左到右3个红外避障传感器 | int SNUM[3] ;//定义3个传感器,从SNUM[0]-SNUM[2]为从左到右3个红外避障传感器 | ||
int INA = 4; //电机A正反转控制端 | int INA = 4; //电机A正反转控制端 | ||
int PWMA = 5; //电机A调速端 | int PWMA = 5; //电机A调速端 | ||
int INB = 7; //电机B正反转控制端 | int INB = 7; //电机B正反转控制端 | ||
int PWMB = 6; //电机B调速端 | int PWMB = 6; //电机B调速端 | ||
void motospd(int sp1,int sp2) //电机速度控制函数。括号内分别为左右电机速度值, | void motospd(int sp1,int sp2) //电机速度控制函数。括号内分别为左右电机速度值, | ||
{ //范围-255~+255,正值为正转,负值为反转。 | { //范围-255~+255,正值为正转,负值为反转。 | ||
if(sp1>0) | if(sp1>0) | ||
digitalWrite(INA, HIGH); | digitalWrite(INA, HIGH); | ||
Line 94: | Line 97: | ||
analogWrite(PWMA,abs (sp1)); | analogWrite(PWMA,abs (sp1)); | ||
analogWrite(PWMB,abs (sp2)); | analogWrite(PWMB,abs (sp2)); | ||
} | } | ||
void setup(){ | void setup(){ | ||
pinMode(11, INPUT); //配置左传感器IO口为输入 | pinMode(11, INPUT); //配置左传感器IO口为输入 | ||
pinMode(12, INPUT); //配置中传感器IO口为输入 | pinMode(12, INPUT); //配置中传感器IO口为输入 | ||
pinMode(13, INPUT); //配置右传感器IO口为输入 | pinMode(13, INPUT); //配置右传感器IO口为输入 | ||
Serial.begin(9600); //打开串口,初始化 | Serial.begin(9600); //打开串口,初始化 | ||
pinMode(INA,OUTPUT); | pinMode(INA,OUTPUT); | ||
pinMode(INB,OUTPUT); //配置电机驱动IO口为输出 | pinMode(INB,OUTPUT); //配置电机驱动IO口为输出 | ||
} | } | ||
void loop(){ | void loop(){ | ||
Line 126: | Line 129: | ||
void setup() { | void setup() { | ||
Serial.begin(9600); // Starting Serial Terminal | Serial.begin(9600); // Starting Serial Terminal } | ||
} | |||
void loop() { | void loop() { | ||
long duration, inches, cm; | long duration, inches, cm; | ||
Line 144: | Line 145: | ||
Serial.println(); | Serial.println(); | ||
delay(100); | delay(100); | ||
} | } | ||
long microsecondsToCentimeters(long microseconds) { | long microsecondsToCentimeters(long microseconds) { | ||
return microseconds / 29 / 2; | return microseconds / 29 / 2; | ||
}/ | }//结果在Arduino串口监视器上看到传感器测量的距离,单位为英寸和厘米。 | ||
3.25 | 3.25 | ||
实物展示图 交互情景详解 视频 | 实物展示图 交互情景详解 视频 | ||
Here is a short video of the Functioning scenario. | Here is a short video of the Functioning scenario. | ||
https://youtu.be/lvkl8N43DuI | https://youtu.be/lvkl8N43DuI | ||
In this video it recorded how this installation works and interaction with human's movement. | In this video it recorded how this installation works and interaction with human's movement. | ||
edits