Stap 34:
In een kamer zonder een heleboel mensen en rommel, ik kan het bereiken van zeer hoge nauwkeurigheid; maar ik denk dat de machine opgeleid me in plaats van andersom.
Software:
p.MsoNormal, li. MsoNormal, div. MsoNormal {marge: 0.0 in; font-size: 12.0pt; font-family: Times New Roman;} div. Afdeling1 {pagina: Deel1;}
#include < Servo.h >
Servo snoep;
Servo roteren;
Servo klink;
Servo voorjaar;
int led2 = 3;
int val2 = 0;
int ledcenter = 6;
int ledPin = 5;
int valm = 0;
int val1 = 0;
VOID Setup
{pinMode (ledPin, OUTPUT);
pinMode(led2,OUTPUT);
pinMode(ledcenter,OUTPUT);
Candy.attach(13);
Rotate.attach(12);
Latch.attach(8);
Spring.attach(7);
Rotate.write(45);
delay(500);
Rotate.write(30);
Latch.write(60);
Spring.write(200);
Candy.write(25);
Candy.write(140);
delay(500);
Candy.write(25);
}
void loop
{
valm=analogRead(0);
val2=analogRead(3);
val1=analogRead(1);
Als (valm > 400 || val1 > 400 || val2 > 400)
val1 = val1-60;
{Als (valm > val2 & & valm > val1)
{digitalWrite (ledPin, hoge);
Rotate.write(130);
delay(500);
Rotate.write(145);
Spring.write(50);
delay(1000);
Latch.write(200);
delay(1000);
Spring.write(200);
delay(500);
Latch.write(60);
delay(1000);
Rotate.write(50);
delay(500);
Rotate.write(30);
Candy.write(140);
delay(500);
Candy.write(25);
digitalWrite (ledPin, laag);
delay(1000);
valm = 0;
val2 = 0;
val1 = 0;
}
anders
{
Als (val2 > valm & & val2 > val1)
{digitalWrite(led2,HIGH);
Rotate.write(75);
Spring.write(50);
delay(1000);
Latch.write(200);
delay(1000);
Spring.write(200);
delay(500);
Latch.write(60);
delay(1000);
Rotate.write(40);
delay(500);
Rotate.write(30);
Candy.write(140);
delay(500);
Candy.write(25);
digitalWrite(led2,LOW);
delay(1000);
valm = 0;
val2 = 0;
val1 = 0;
}
anders
{Als (val1 > valm & & val1 > val2)
{digitalWrite(ledcenter,HIGH);
Rotate.write(110);
Spring.write(50);
delay(1000);
Latch.write(200);
delay(1000);
Spring.write(200);
delay(500);
Latch.write(60);
delay(1000);
Rotate.write(40);
delay(500);
Rotate.write(30);
Candy.write(140);
delay(500);
Candy.write(25);
digitalWrite(ledcenter,LOW);
delay(1000);
valm = 0;
val2 = 0;
val1 = 0;
}}}}}