-
Notifications
You must be signed in to change notification settings - Fork 0
/
DigitalPins0and1.ino
31 lines (28 loc) · 1.22 KB
/
DigitalPins0and1.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// PROJECT :DigitalPins0and1
// PURPOSE :Demonstrates the use of Digital Pins 0 and 1 when Serial Communication not required
// DEVICE :Arduino UNO
// AUTHOR :C. D'Arcy
// DATE :2019 01 10
// uC :328p
// COURSE :ICS3U
// STATUS :Working
// NOTES :Disconnect any component from digital pins 0 and 1 when uploading this code
#define RX 0 //Normally used for receiving bytes in the serial stream
#define TX 1 //Normally used for transmitting bytes in the serial stream
#define DURATION 500 //Frequency of flashing (default: 1Hz)
void setup() {
Serial.begin(9600);
Serial.println("Disconnect any component from digital pins 0 and 1 when uploading this code.");
Serial.println("Once uploaded, insert a bicolor LED into pins 0 and 1.");
Serial.end(); //disconnect the UART (serial comm stream)
pinMode(RX,OUTPUT); //digital pin 0 is now free for use
pinMode(TX,OUTPUT); //digital pin 1 is now free for use
}
void loop() {
digitalWrite(RX,HIGH); //depending on the LED orientation, turn one colour on
digitalWrite(TX,LOW);
delay(DURATION); //admire...
digitalWrite(RX,LOW); //turn the other colour on
digitalWrite(TX,HIGH);
delay(DURATION); //admire...
}