“我和我的祖国”国庆花车
2019-10-13964
AI 快速预览详细
智能机器人花车是一个创意项目,旨在庆祝祖国70周年生日。该项目由三个功能组成:旋转音乐盒、红旗挥舞和自动升旗。主要材料包括Arduino UNO板、舵机、电机和MP3播放器。通过这个项目,孩子们可以锻炼动手能力和创造力,同时激发爱国情怀。
步骤1 花车模型:利用kt板制作了花车模型,再用一些小花,卡纸进行装饰。
步骤2 旋转的音乐盒:利用电机将小人旋转同时用MP3播放《我和我的祖国》。
步骤3 红旗挥舞:利用舵机 ,红旗摇摆,达到挥舞的效果,此时播放音乐《红旗飘飘》。
步骤4 自动升旗装置:利用电机将国旗升起,伴随着国歌缓缓上升。
材料清单
- Arduino UNO板 X1
- 舵机 X1
- 电机 X2
- MP3播放器 X1
代码
void setup(){
delay(20);
pinMode(5,OUTPUT);
pinMode(7,OUTPUT);
pinMode(6,OUTPUT);
pinMode(8,OUTPUT);
}
void loop(){
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (12))) {
play.SetVolume(31);
play.PlayMode(3);
}
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (24))) {
play.PlayMode(1);
dc_cfun5.motorrun(1,80);
}
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (94))) {
dc_cfun5.motorrun(1,0);
play.PlayMode(2);
}
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (8))) {
dc_cfun6.motorrun(1,60);
delay(1000*9);
dc_cfun6.motorrun(1,0);
}
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (28))) {
for(int repeatci=0;repeatci<50;repeatci++){
pinMode(6,OUTPUT);
myservo_cfun6.attach(6);
myservo_cfun6.write(45);
delay(1000*0.45);
pinMode(6,OUTPUT);
myservo_cfun6.attach(6);
myservo_cfun6.write(135);
delay(1000*0.45);
}
pinMode(6,OUTPUT);
myservo_cfun6.attach(6);
myservo_cfun6.write(90);
}
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (90))) {
dc_cfun6.motorrun(0,60);
delay(1000*9);
dc_cfun6.motorrun(1,0);
}
}步骤5 花车模型:利用kt板制作了花车模型,再用一些小花,卡纸进行装饰。
步骤6 旋转的音乐盒:利用电机将小人旋转同时用MP3播放《我和我的祖国》。
步骤7 红旗挥舞:利用舵机 ,红旗摇摆,达到挥舞的效果,此时播放音乐《红旗飘飘》。
步骤8 自动升旗装置:利用电机将国旗升起,伴随着国歌缓缓上升。
材料清单
- Arduino UNO板 X1
- 舵机 X1
- 电机 X2
- MP3播放器 X1
代码
void setup(){
delay(20);
pinMode(5,OUTPUT);
pinMode(7,OUTPUT);
pinMode(6,OUTPUT);
pinMode(8,OUTPUT);
}
void loop(){
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (12))) {
play.SetVolume(31);
play.PlayMode(3);
}
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (24))) {
play.PlayMode(1);
dc_cfun5.motorrun(1,80);
}
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (94))) {
dc_cfun5.motorrun(1,0);
play.PlayMode(2);
}
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (8))) {
dc_cfun6.motorrun(1,60);
delay(1000*9);
dc_cfun6.motorrun(1,0);
}
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (28))) {
for(int repeatci=0;repeatci<50;repeatci++){
pinMode(6,OUTPUT);
myservo_cfun6.attach(6);
myservo_cfun6.write(45);
delay(1000*0.45);
pinMode(6,OUTPUT);
myservo_cfun6.attach(6);
myservo_cfun6.write(135);
delay(1000*0.45);
}
pinMode(6,OUTPUT);
myservo_cfun6.attach(6);
myservo_cfun6.write(90);
}
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (90))) {
dc_cfun6.motorrun(0,60);
delay(1000*9);
dc_cfun6.motorrun(1,0);
}
}步骤9 花车模型:利用kt板制作了花车模型,再用一些小花,卡纸进行装饰。
步骤10 旋转的音乐盒:利用电机将小人旋转同时用MP3播放《我和我的祖国》。
步骤11 红旗挥舞:利用舵机 ,红旗摇摆,达到挥舞的效果,此时播放音乐《红旗飘飘》。
步骤12 自动升旗装置:利用电机将国旗升起,伴随着国歌缓缓上升。
材料清单
- Arduino UNO板 X1
- 舵机 X1
- 电机 X2
- MP3播放器 X1
代码
void setup(){
delay(20);
pinMode(5,OUTPUT);
pinMode(7,OUTPUT);
pinMode(6,OUTPUT);
pinMode(8,OUTPUT);
}
void loop(){
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (12))) {
play.SetVolume(31);
play.PlayMode(3);
}
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (24))) {
play.PlayMode(1);
dc_cfun5.motorrun(1,80);
}
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (94))) {
dc_cfun5.motorrun(1,0);
play.PlayMode(2);
}
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (8))) {
dc_cfun6.motorrun(1,60);
delay(1000*9);
dc_cfun6.motorrun(1,0);
}
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (28))) {
for(int repeatci=0;repeatci<50;repeatci++){
pinMode(6,OUTPUT);
myservo_cfun6.attach(6);
myservo_cfun6.write(45);
delay(1000*0.45);
pinMode(6,OUTPUT);
myservo_cfun6.attach(6);
myservo_cfun6.write(135);
delay(1000*0.45);
}
pinMode(6,OUTPUT);
myservo_cfun6.attach(6);
myservo_cfun6.write(90);
}
pinMode(11,INPUT);
if(((ir_cfun11.getCode()) == (90))) {
dc_cfun6.motorrun(0,60);
delay(1000*9);
dc_cfun6.motorrun(1,0);
}
}


