1. Hardware [Kembali]
A. LED
B. Push Button
2. Rangkaian Simulasi [Kembali]
A. Receiver
C. Gabungan
3. Flowchart [Kembali]
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); } } //
0 komentar:
Posting Komentar