10, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 128000 and 256000
10, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 128000 and 256000
Baudrate predstavuje rýchlosť komunikácie (bity za sekundu)
Inicializacia komunikácie pomocou príkazu begin()
10, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 128000 and 256000
Príkaz print() odošle parameter na sériovu linku
Príkaz println() odošle parameter na sériovu linku a CR NL (novy riadok)
void setup()
{
Serial.begin(9600);
Serial.println("Arduino sa prave zaplo");
}
void loop()
{
Serial.println("Hello);
delay(1000)
}
10, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 128000 and 256000
Vracia analógovú hodnotu na pine
void setup()
{
Serial.begin(9600);
}
void loop()
{
int = analogRead(A0);
Serial.println(A0);
delay(1000)
}
10, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 128000 and 256000
Vracia počet neprečítaných znakov v buffri
void setup()
{
pinMode(13, OUTPUT);
Serial.begin(9600);
Serial.println("Input 1 to Turn LED on and 2 to off");
}
void loop()
{
if (Serial.available())
{
int state = Serial.parseInt();
if (state == 1)
{
digitalWrite(4, HIGH);
Serial.println("Command completed LED turned ON");
}
if (state == 2)
{
digitalWrite(4, LOW);
Serial.println("Command completed LED turned OFF");
}
}
}