1. 材料清单
1.1 兔子头乐高相关材料
元宵兔子头1.2 兔子身体乐高相关材料
元宵兔子身体1.3 电子及其它设备材料
Arduino Uno电路板1个
Arduino UNO R3开发板乐高保护外壳一个
迷你面包板一个
5MM LED发光二极管红色2个、黄色、蓝色各1个
220欧的电阻4个
杜邦线公对公6根(10CM就够了)
杜邦线公对母4根(15CM就够了)
五号电池电池盒(带开关)一个
14500锂电池 3.7V 2节
热熔胶枪(用于固定LED灯接线,可选)
2. 乐高齿轮组的搭建
2.1 兔子头搭建
在线查看分步搭建指南 :https://waydo.xyz/ldd/2019/rabbit-head.html
2.2 兔子身体搭建
在线查看分步搭建指南 :https://waydo.xyz/ldd/2019/rabbit-body.html
●兔子身体搭建要点
2.3 乐高部分整合身体搭建
2.4 电子设备安装
2.5 Arduino代码
[cc lang=”c” lines=”100″ width=”800″]
int lEyeLedPin = 5;
int rEyeLedPin = 4;
int yLedPin = 7;
int bLedPin = 6;
void setup() {
// put your setup code here, to run once:
pinMode(lEyeLedPin, OUTPUT);
pinMode(rEyeLedPin, OUTPUT);
pinMode(yLedPin, OUTPUT);
pinMode(bLedPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(bLedPin, LOW);
digitalWrite(yLedPin, LOW);
digitalWrite(rEyeLedPin, LOW);
digitalWrite(lEyeLedPin, HIGH);
delay(500);
digitalWrite(rEyeLedPin, HIGH);
digitalWrite(lEyeLedPin, LOW);
delay(500);
digitalWrite(lEyeLedPin, HIGH);
digitalWrite(rEyeLedPin, HIGH);
delay(200);
digitalWrite(rEyeLedPin, LOW);
digitalWrite(lEyeLedPin, LOW);
delay(200);
digitalWrite(rEyeLedPin, HIGH);
digitalWrite(lEyeLedPin, HIGH);
delay(200);
digitalWrite(rEyeLedPin, LOW);
digitalWrite(lEyeLedPin, LOW);
delay(200);
digitalWrite(rEyeLedPin, HIGH);
digitalWrite(lEyeLedPin, HIGH);
delay(200);
digitalWrite(bLedPin, LOW);
digitalWrite(yLedPin, HIGH);
delay(4000);
digitalWrite(bLedPin, HIGH);
digitalWrite(yLedPin, LOW);
delay(4000);
digitalWrite(bLedPin, LOW);
digitalWrite(yLedPin, HIGH);
delay(300);
digitalWrite(bLedPin, HIGH);
digitalWrite(yLedPin, LOW);
delay(300);
digitalWrite(bLedPin, LOW);
digitalWrite(yLedPin, HIGH);
delay(300);
digitalWrite(bLedPin, HIGH);
digitalWrite(yLedPin, LOW);
delay(300);
digitalWrite(bLedPin, LOW);
digitalWrite(yLedPin, HIGH);
delay(300);
digitalWrite(bLedPin, HIGH);
digitalWrite(yLedPin, LOW);
delay(300);
digitalWrite(bLedPin, HIGH);
digitalWrite(yLedPin, HIGH);
delay(200);
digitalWrite(bLedPin, LOW);
digitalWrite(yLedPin, LOW);
delay(200);
digitalWrite(bLedPin, HIGH);
digitalWrite(yLedPin, HIGH);
delay(200);
digitalWrite(bLedPin, LOW);
digitalWrite(yLedPin, LOW);
delay(200);
digitalWrite(bLedPin, HIGH);
digitalWrite(yLedPin, HIGH);
delay(5000);
}
[/cc]
近期评论