贪财的小猫(The Greedy Cat)

Copyright Claim

贪财的小猫(The Greedy Cat)

Boost
2
1
0
GIF
GIF

Print Profile(2)

All
A1
P1S
P1P
X1
X1 Carbon
X1E

0.2mm layer, 2 walls, 15% infill
0.2mm layer, 2 walls, 15% infill
Designer
6.6 h
3 plates

0.2mm layer, 2 walls, 15% infill
0.2mm layer, 2 walls, 15% infill
Designer
5.7 h
3 plates

Open in Bambu Studio
Boost
2
1
0
0
1
0
Released

Description

A small production, children will like it very much. Material list: 1 Arduino UNO R3 1 SG90 2 LEDs 1 button Please implement it with reference to the following code.

 

一个小制作,小朋友会很喜欢

 

物料清单:

Arduino UNO R3 1个

SG90 1个

LED 2个

按钮 1个

 

请把参考以下代码实现

 

#include 
Servo myservo; 
int led1Pin=8;
int led2Pin=11;
int buttonPin=13;
int i;
int val=0;
int val1=0;

void setup() {

Serial.println("Run control");
myservo.attach(2);
Serial.begin(9600);
pinMode(led1Pin,OUTPUT);
pinMode(buttonPin,INPUT);

}
void loop() {
val=digitalRead(buttonPin);
if(val==1){
digitalWrite(led1Pin,HIGH ); 
digitalWrite( led2Pin,HIGH );

myservo.write(155); 
delay(500);
myservo.write(60);
delay(200);
myservo.write(25); 
delay(400);
myservo.write(155); 
delay(200);

digitalWrite(led1Pin,LOW); 
digitalWrite( led2Pin,LOW ); 


}

Comment & Rating (0)

Please fill in your opinion
(0/5000)

No more