Basic commands in Arduino basic samples

  1. Analog Read Serial

Function: setup() : runs once when you press reset

Function: loop() : runs over and over again forever

Serial.begin(bps): init a serial communication at bits per second.

analogRead(A0) : read input on analog pin 0 (A0)

Serial.println(string): print out Serial window

delay(millisecond): delay between loops.

2. Concat String


int sensorValue = analogRead(A0);

String strValue = “value: “;

Serial.println(strValue + sensorValue);

But error compile:

Serial.println(“value: “ + sensorValue);

3. Blink

pinMode(13, OUTPUT/INPUT) : initialize digital pin 13 as an output/input

digitalWrite(13, HIGH/LOW): turn LED on (HIGH or LOW is the voltage level)