int motorPin = 3; //priradenie pinu pre motor void setup() { pinMode(motorPin, OUTPUT); Serial.begin(9600); while (! Serial); Serial.println("Rychlost motora od 0 do 255"); } void loop() { if (Serial.available()) { int rychlost_motora = Serial.parseInt(); //zadanie rýchlosti cez sériový monitor Serial.println("Aktualna rychlost je:"); Serial.println(rychlost_motora); if (rychlost_motora >= 0 && rychlost_motora <= 255) { //rozsah rýchlosti analogWrite(motorPin, rychlost_motora); //pohyb motora } } }