Search models, users, collections, and posts
The Greedy Cat
IP Report
Print Profile(2)

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

0.2mm layer, 2 walls, 15% infill
Designer
5.7 h
3 plates
Open in Bambu Studio
Boost
3
6
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 );
}
}
License
This user content is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike







Comment & Rating (0)