Şimdi Ara

Kodları verilen projenin şemasını nasıl çizilir ?

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
2 Misafir - 2 Masaüstü
5 sn
3
Cevap
0
Favori
108
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • Aşağıda kodları verilen projelerin şemasını nasıl çizebilirim yardımcı olabilecek var mı
    // Arduino Wave
    // Proje

    #include <Servo.h>

    Servo left;
    Servo right;

    int pos = 20;
    int back = 20;
    int forward = 160;
    int spe = 15;

    int red = 6;
    int green = 5;
    int blue = 4;

    void setup() {

    Serial.begin(9600);

    left.attach(2);
    right.attach(3);

    pinMode(red, OUTPUT);
    pinMode(green, OUTPUT);
    pinMode(blue, OUTPUT);

    left.write(back);
    right.write(back);

    digitalWrite(green, HIGH);
    delay(1000);
    digitalWrite(green, LOW);
    delay(1000);
    digitalWrite(red, HIGH);
    delay(1000);
    digitalWrite(red, LOW);
    delay(1000);

    }

    void loop() {

    int pent = analogRead(A0);
    Serial.println(pent);
    spe = map(pent, 0, 1023, 15, 1);

    if (spe >= 10) {
    digitalWrite(green, HIGH);
    digitalWrite(blue, LOW);
    digitalWrite(red, LOW);
    }
    else if (spe < 10 && spe >= 5) {
    digitalWrite(green, LOW);
    digitalWrite(blue, HIGH);
    digitalWrite(red, LOW);
    }
    else if (spe < 5 && spe >= 1) {
    digitalWrite(green, LOW);
    digitalWrite(blue, LOW);
    digitalWrite(red, HIGH);
    }

    for (pos = back; pos <= forward; pos += 1) {
    left.write(pos);
    right.write(pos);
    delay(spe);
    }
    for (pos = forward; pos >= back; pos -= 1) {
    left.write(pos);
    right.write(pos);
    delay(spe);
    }
    }







    // Arduino Wave 2
    // proje 2

    #include <Servo.h>

    Servo left;
    Servo right;

    int pos = 20;
    int post = 160;
    int back = 20;
    int forward = 160;

    int red = 6;
    int green = 5;
    int blue = 4;

    int slow = 8;
    int fast = 4;

    void setup() {

    Serial.begin(9600);

    left.attach(2);
    right.attach(3);

    pinMode(red, OUTPUT);
    pinMode(green, OUTPUT);
    pinMode(blue, OUTPUT);

    left.write(back);
    right.write(back);

    digitalWrite(green, HIGH);
    delay(1000);
    digitalWrite(green, LOW);
    delay(1000);
    digitalWrite(red, HIGH);
    delay(1000);
    digitalWrite(red, LOW);
    delay(1000);

    }

    void loop() {

    int pent = analogRead(A0);
    Serial.println(pent);

    if (pent < 200) {
    digitalWrite(blue, HIGH);
    digitalWrite(red, LOW);
    digitalWrite(green, LOW);
    for (pos = back; pos <= forward; pos += 1) {
    left.write(pos);
    right.write(pos);
    delay(slow);
    }
    for (pos = forward; pos >= back; pos -= 1) {
    left.write(pos);
    right.write(pos);
    delay(slow);
    }
    }
    else if (pent > 200 && pent < 450) {
    digitalWrite(blue, LOW);
    digitalWrite(red, HIGH);
    digitalWrite(green, LOW);
    for (pos = back; pos <= forward; pos += 1) {
    left.write(pos);
    right.write(pos);
    delay(fast);
    }
    for (pos = forward; pos >= back; pos -= 1) {
    left.write(pos);
    right.write(pos);
    delay(fast);
    }
    }
    else if (pent > 450 && pent < 700) {
    digitalWrite(blue, LOW);
    digitalWrite(red, LOW);
    digitalWrite(green, HIGH);
    for (pos = back; pos <= forward; pos += 1) {
    post = map(pos, 20, 160, 160, 20);
    left.write(pos);
    right.write(post);
    delay(slow);
    }
    for (pos = forward; pos >= back; pos -= 1) {
    post = map(pos, 160, 20, 20, 160);
    left.write(pos);
    right.write(post);
    delay(slow);
    }
    }
    else if (pent > 700 && pent < 1023) {
    digitalWrite(blue, LOW);
    digitalWrite(red, HIGH);
    digitalWrite(green, LOW);
    for (pos = back; pos <= forward; pos += 1) {
    post = map(pos, 20, 160, 160, 20);
    left.write(pos);
    right.write(post);
    delay(fast);
    }
    for (pos = forward; pos >= back; pos -= 1) {
    post = map(pos, 160, 20, 20, 160);
    left.write(pos);
    right.write(post);
    delay(fast);
    }
    }
    }







  • Ne kodu bunlar ?
  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.