microrobotics icon

KL715 Wireless Tx+Rx 433MHz - Learn

microrobotics | PRO | 07/02/24 10:40:37 AM UTC | 0 ⭐ | 12684 👁️ | Never ⏰ | []
Arduino |

980 B

|

None

|

0 👍

/

0 👎

#define D0_PIN 16
#define D1_PIN 17
#define D2_PIN 18
#define D3_PIN 19
#define VT_PIN 21  // Optional, for valid transmission detection
 
void setup() {
  Serial.begin(115200);    // Initialize serial communication
  
  // Set D0-D3 pins and VT_PIN as inputs
  pinMode(D0_PIN, INPUT);
  pinMode(D1_PIN, INPUT);
  pinMode(D2_PIN, INPUT);
  pinMode(D3_PIN, INPUT);
  pinMode(VT_PIN, INPUT);
}
 
void loop() {
  if (digitalRead(VT_PIN) == HIGH) { // Check if the VT pin is HIGH (valid transmission detected)
    // Read from each data pin
    int d0_value = digitalRead(D0_PIN);
    int d1_value = digitalRead(D1_PIN);
    int d2_value = digitalRead(D2_PIN);
    int d3_value = digitalRead(D3_PIN);
 
    // Print the values of each data pin
    Serial.print("D0: ");
    Serial.print(d0_value);
    Serial.print(" D1: ");
    Serial.print(d1_value);
    Serial.print(" D2: ");
    Serial.print(d2_value);
    Serial.print(" D3: ");
    Serial.println(d3_value);
  }
}
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎