0% found this document useful (0 votes)
9 views

Master Code

This document defines code for an Arduino sketch that uses an LED pin and RS485 enable pin to send character data over serial communication. The sketch sets up the pins, sends character 'A' every second while enabling the RS485 pin high, then sets the pin low again.

Uploaded by

sentana2208
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Master Code

This document defines code for an Arduino sketch that uses an LED pin and RS485 enable pin to send character data over serial communication. The sketch sets up the pins, sends character 'A' every second while enabling the RS485 pin high, then sets the pin low again.

Uploaded by

sentana2208
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#define LED 13 // Declare LED pin

#define MASTER_EN 8 // connected to RS485 Enable pin

void setup() {
pinMode(LED , OUTPUT); // Declare LED pin as output
pinMode(MASTER_EN , OUTPUT); // Declare Enable pin as output
Serial.begin(9600); // set serial communication baudrate
digitalWrite(MASTER_EN , LOW); // Make Enable pin low
// Receiving mode ON
}

void loop() {
digitalWrite(MASTER_EN , HIGH); // Make Enable pin high to send Data
delay(5); // required minimum delay of 5ms
Serial.println('A'); // Send character A serially
Serial.flush(); // wait for transmission of data
delay(1000);
digitalWrite(MASTER_EN , LOW); // Receiving mode ON
}

You might also like