Hirdetés

2024. június 16., vasárnap

Gyorskeresés

Téma összefoglaló

Téma összefoglaló

  • Utoljára frissítve: 2023-03-11 00:46:52

LOGOUT.hu

Arduino hardverrel és szoftverrel foglakozó téma. Minden mikrovezérlő ami arduinoval programozható, és minden arduino program, board, és hardverrel kapcsolatos kérdések helye.

Összefoglaló kinyitása ▼

Hozzászólások

(#1147) #96292352 válasza #96292352 (#1146) üzenetére


#96292352
törölt tag

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;
}

Copyright © 2000-2024 PROHARDVER Informatikai Kft.