These functions are use to get information from, and send information to, the digital pins.
digitalRead();
digitalWrite();
These functions are specific to the Arduino language, since they communicate directly with the hardware pins. Being digital, the expected responses are either 1 or 0 - in other words the pin can only be either on or off. It is, however, possible to alter the speed, or frequency, that the pins turn on and off at using a technique known as Pulse Width Modulation. In the Arduino world, not all pins are created equal, as only the digital pins specifically labelled with PWM are capable of this. PWM pins may also be identified by the tilde character, ~, beside the pin number.
analogRead();
analogWrite();
Rather than being functions by themselves, the following are functions that are made available through the Serial library.
When printing data standard escape characters (create table) are supported, however the full functionalities of a function like printf()
and scanf()
in the C language are not available in Arduino.
Serial.begin();
Serial.available();
Serial.read();
Serial.write();
Serial.print();
Serial.println();
Typically converting between typed characters (Latin, Cyrillic, Arabic etc.) is handled by something like an ASCII table, or some extended version. [add some background]
The following gist gives an example of this. It stores the input as an integer and then displays it either as the keyboard character we just pressed or its underlying ASCII value:
For you convenience I've also prepared a searchable table with 128 different characters and their corresponding numeric values.
In this example, the Arduino accepts values through the serial monitor and changes the state of the LEDs accordingly.
For the sake of completeness, it is worth mentioning the functions of the Stream
library.
available()
read()
flush()
find()
findUntil()
peek()
readBytes()
readBytesUntil()
readString()
readStringUntil()
parseInt()
parsefloat()
setTimeout()