#include <Servo.h>
#include <Wire.h>
#include <Encoder.h>
#include "Displejolosos.h"
Servo servoros;
Encoder encoder(2, 3);
int goduhel;
void setup() {
Displejolosos displejos;
displejos.clear();
servoros.attach(9);
}
void loop() {
Displejolosos displejos;
int encoderHodnota = encoder.read();
int uhel = map(encoderHodnota, 0, 1023, 0, 180);
goduhel = constrain(uhel, 0, 180);
if (uhel > 180) {
encoder.write(1023);
}else if (uhel < 0) {
encoder.write(0);
}
displejos.setTextSize(2);
displejos.println("Naklon");
displejos.println("uhlu: ");
displejos.println(goduhel);
displejos.displej();
servoros.write(uhel);
delay(1000);
}