Komunikasi UART



1. Hardware [Kembali]


A. LED


B. Push Button



2. Rangkaian Simulasi [Kembali]


A. Receiver


B. Transmitter


C. Gabungan


3. Flowchart [Kembali]


A. Receiver


B. Transmitter



4. Listing Program [Kembali]


A. Transmitter

//
#define BUTTON 2

void setup() {
  Serial.begin(9600);
  pinMode(BUTTON, INPUT);
}

void loop() {
  if (digitalRead(BUTTON) == LOW) {
    Serial.write(1);
  } else {
    Serial.write(0);
  }
}
//

B. Receiver

//
#define LED 2

void setup() {
  Serial.begin(9600);
  pinMode(LED, OUTPUT);
}

void loop() {
  uint8_t in = Serial.read();
  if (in == 1) {
    digitalWrite(LED, HIGH);
  } else {
    digitalWrite(LED, LOW);
  }
}
//

5. Video Simulasi [Kembali]



6. Link Download [Kembali]









0 komentar:

Posting Komentar