Új hozzászólás Aktív témák

  • #96292352

    törölt tag

    válasz #96292352 #1146 üzenetére

    Ebben van a baj:

    int DHpin = 7;
    int DH2pin = 9;
    byte dat [5];
    byte dat2 [5];
    byte read_data () {
    byte data;
    for (int l = 0; l < 8; l ++) {
    if (digitalRead (DHpin) == LOW) {
    while (digitalRead (DHpin) == LOW); // wait for 50us
    delayMicroseconds (30); // determine the duration of the high level to determine the data is '0 'or '1'
    if (digitalRead (DHpin) == HIGH)
    data |= (1 << (7-l)); // high front and low in the post
    while (digitalRead (DHpin) == HIGH); // data '1 ', wait for the next one receiver
    }
    }

    /* 2nd sensor */
    byte dat2;
    for (int i = 0; i < 8; i ++) {
    if (digitalRead (DH2pin) == LOW) {
    while (digitalRead (DH2pin) == LOW); // wait for 50us
    delayMicroseconds (30); // determine the duration of the high level to determine the data is '0 'or '1'
    if (digitalRead (DH2pin) == HIGH)
    data |= (1 << (7-i)); // high front and low in the post
    while (digitalRead (DH2pin) == HIGH); // data '1 ', wait for the next one receiver
    }
    }
    return data;
    }

Új hozzászólás Aktív témák