Arduino: The most important commands at a glance
Related Videos: Learn Oscilloscope Basics with an Arduino Uno and RTM3004 | AddOhms #28 (April 2024).
In this practical tip, we explain which commands are important for the Arduino.
Arduino: the basic commands
The Arduino has some commands that could be useful for many projects. We show you the most important commands here.
- With "pinMode ([Pin], [INPUT / INPUT_PULLUP / OUTPUT]);" you can define a pin as an output, input or input with pull-up resistor.
- You can change the value of a pin with "digitalRead ([Pin]);" digital (0 or 1), or with the command "analogRead ([Pin]);" read out analog (0 - 1023).
- To change the value of a pin, you can either use the command "digitalWrite ([Pin], [HIGH / LOW]);" change digitally, or for analog pins this with "analogWrite ([Pin], [0 - 255]);" to change.
- With the command "delay (1000);" for example, you can pause the program for 1000 milliseconds.
Serial monitor on the Arduino
You can use the serial monitor for serial communication with the Arduino.
- With the command "Serial.begin ([Baudrate]);" start the serial monitor.
- With "Serial.print ([String]);" you can output text and use "Serial.println ([String]);" Output text and start a new line.
- You can also use "Serial.read ();" or "Serial.readString ()" read data and check with "Serial.available ()" whether a connection is available.
In the next article, you will learn how to control LEDs with the Arduino.