SunFounder 3in1 Kit
2. About Pin13.
All digital pins (1-13) on the R4 board can be used as digitalRead(). But digital pin 13 is more
difficult to use as a digital input than other digital pins. Because it connects an LED and resistor, it
is soldered on most boards. If you enable its internal 20k pull-up resistor, it will hang around 1.7V
instead of the expected 5V because the onboard LED and series resistor pull the voltage level low,
which means it always returns LOW. If you must use pin 13 as a digital input, set its pinMode() to
INPUT and use an external pull-down resistor.
3. Analog pins.
If the digital pins are not enough, the analog pins (A0-A5) can also be used as digital pins. It needs
to be set to INPUT with pinMode(pin,mode).
Related Components
Below are the related components, you can click in to learn how to use them.
4.3.1 3.0 Serial Monitor
In the Arduino IDE, there is a serial monitor that allows you to send messages from your computer to the Arduino board
(via USB) and also to receive messages from the Arduino.
So in this project we will learn how to receive data from the Arduino board.
Note: On Uno, Nano, Mini, and Mega, pins 0 and 1 are used for communication with the computer. Connecting
anything to these pins can interfere with that communication, including causing failed uploads to the board.
Using the Serial Monitor
1. Open the Arduino IDE, and paste the following code in it.
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
int number = 100;
Serial.println(number);
Serial.println("Hello world");
delay(100); // delay in between reads for stability
}
• Serial.begin(): Sets the data rate in bits per second (baud) for serial data transmission, here set to 9600.
• Serial.println(): Prints data to the serial port as human-readable ASCII text followed by a carriage return
character (ASCII 13, or ‘r’) and a newline character (ASCII 10, or ‘n’). This command takes the same
forms as Serial.print().
2. Select the correct board and port to upload the code.
3. In the toolbar, click the magnifying glass icon to turn on Serial Monitor.
4.3. 3. Digital Read 105