Interactive LED Circuit
The principle of this assignment is actually not difficult, but the main difficulty is that it is difficult to understand these points in class, and some details in it may take me half a day to understand in my native language.
Serial.begin(9600);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13,OUTPUT);
}
void loop() {
if(analogRead(A0)<400){
digitalWrite(11,HIGH);
digitalWrite(12,LOW);
digitalWrite(13,LOW);
}
if(analogRead(A0)>400&&analogRead(A0)<800){
digitalWrite(11,LOW);
digitalWrite(12,HIGH);
digitalWrite(13,LOW);
}
if(analogRead(A0)>800&&analogRead(A0)<1600){
digitalWrite(11,LOW);
digitalWrite(12,LOW);
digitalWrite(13,HIGH);
}
if(analogRead(A0)>1600&&analogRead(A0)<2400){
digitalWrite(11,HIGH);
digitalWrite(12,LOW);
digitalWrite(13,LOW);
}
if(analogRead(A0)>2400){
digitalWrite(11,LOW);
digitalWrite(12,HIGH);
digitalWrite(13,LOW);
}
https://youtube.com/shorts/X5dCHrG1TyU
This device can be used for an interactive figure with 3 different colored leds built into its head, and then the sensors are placed in the figure's treasure. The audience can change the color of the led by rotating the treasure, which is used to reflect the change of the doll's mood.
评论
发表评论