This repository has been archived on 2025-03-06. You can view files and clone it, but cannot push or open issues or pull requests.
machines-backup/vendor/arduino/Arduino_MachineControl/examples/Encoders/Encoders.ino
2024-10-01 19:14:56 +02:00

29 lines
773 B
C++

#include <Arduino_MachineControl.h>
using namespace machinecontrol;
void setup() {
Serial.begin(9600);
while (!Serial);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print("Encoder 0 State: ");
Serial.println(encoders[0].getCurrentState(),BIN);
Serial.print("Encoder 0 Pulses: ");
Serial.println(encoders[0].getPulses());
Serial.print("Encoder 0 Revolutions: ");
Serial.println(encoders[0].getRevolutions());
Serial.println();
Serial.print("Encoder 1 State: ");
Serial.println(encoders[1].getCurrentState(),BIN);
Serial.print("Encoder 1 Pulses: ");
Serial.println(encoders[1].getPulses());
Serial.print("Encoder 1 Revolutions: ");
Serial.println(encoders[1].getRevolutions());
Serial.println();
delay(25);
}