Arduino Uno, Motor Shield and Ethernet Shield with Poe Pin Çakışması
  • Merhaba ,

    Hazırlamış olduğum RC Car projesi için Arduino uno Ethernet shield with
    poe ve Motor shield parçalarını kullanmaktayım. Motor shield i direk
    arduino uno ya bağladığımda sorunsuz çalışıyor. Fakat motor shield i
    Arduino dan çıkarıp ethernet shield i , onun üstüne de motor shield i
    taktığım zaman motorun hareketleri bozuluyor. Yazdığım kod aşağıdaki
    gibidir. Motorlar motor shield in a ve b çıkışlarına bağlıdır. Pinlerle ilgili çakışmayı nasıl giderebilirim.



    #include
    #include

    byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0x08, 0xAF }; //physical mac address
    byte ip[] = { 192, 168, 0, 199 }; // fixed IP addr in LAN
    byte gateway[] = { 192, 168, 0, 100 }; // internet access via router
    byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
    EthernetServer server(80); //server port

    String readString;
    //////////////////////
    void setup(){

    //Setup Channel A
    pinMode(12, OUTPUT); //Initiates Motor Channel A pin
    pinMode(9, OUTPUT); //Initiates Brake Channel A pin

    //Setup Channel B
    pinMode(13, OUTPUT); //Initiates Motor Channel B pin
    pinMode(8, OUTPUT); //Initiates Brake Channel B pin

    digitalWrite(9, HIGH); //Disengage the Brake for Channel A
    digitalWrite(8, HIGH); //Disengage the Brake for Channel B

    //start Ethernet
    Ethernet.begin(mac, ip, gateway, subnet);
    server.begin();
    //enable serial data print
    Serial.begin(9600);
    Serial.println("server LED test 1.0 ---- FILENAME = LED2.ino ");
    }

    void loop(){
    // Create a client connection
    EthernetClient client = server.available();
    if (client) {
    while (client.connected()) {
    if (client.available()) {
    char c = client.read();

    //read char by char HTTP request
    if (readString.length() < 100) {

    //store characters to string
    readString += c;
    //Serial.print(c);
    }

    //if HTTP request has ended
    if (c == '\n') {

    ///////////////
    Serial.println(readString); //print to serial monitor for debuging
    client.println("HTTP/1.1 200 OK"); //send new page
    client.println("Content-Type: text/html");
    client.println();
    client.println("");
    client.println("");
    client.println("Home Automation");
    client.println("");
    client.println("");
    client.println("

    Home Automation

    ");
    client.println("
    ");
    client.println("
    ");

    client.println("Ileri");
    client.println("
    ");
    client.println("
    ");
    client.println("Geri");
    client.println("
    ");
    client.println("
    ");
    client.println("Dur");

    client.println("");
    client.println("");

    delay(1);
    //stopping client
    client.stop();

    ///////////////////// control arduino pin
    if(readString.indexOf("?ileri") >0)//checks for on
    {
    //Motor A forward @ full speed
    digitalWrite(12, HIGH); //Establishes forward direction of Channel A
    digitalWrite(9, LOW); //Disengage the Brake for Channel A
    analogWrite(3, 255); //Spins the motor on Channel A at full speed

    //Motor B backward @ half speed
    digitalWrite(13, LOW); //Establishes backward direction of Channel B
    digitalWrite(8, LOW); //Disengage the Brake for Channel B
    analogWrite(11, 255); //Spins the motor on Channel B at half speed
    }

    if(readString.indexOf("?dur") >0)//checks for off
    {
    digitalWrite(9, HIGH); //Disengage the Brake for Channel A
    digitalWrite(8, HIGH); //Disengage the Brake for Channel B

    }


    if(readString.indexOf("?geri") >0)//checks for off
    {
    digitalWrite(12, LOW); //Establishes backward direction of Channel A
    digitalWrite(9, LOW); //Disengage the Brake for Channel A
    analogWrite(3, 255); //Spins the motor on Channel A at half speed

    //Motor B forward @ full speed
    digitalWrite(13, HIGH); //Establishes forward direction of Channel B
    digitalWrite(8, LOW); //Disengage the Brake for Channel B
    analogWrite(11, 255); //Spins the motor on Channel B at full speed
    }

    readString=""; //clearing string for next read

    }
    }
    }
    }
    }
  • 10,11,12,13 sanırım bunları ethernet shield kullanıyor pinleri degistir.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook
Açık kaynak kültürü gereği, çözdüğünüz problemlerin çözümlerini paylaşmayı lütfen unutmayın.