Untitled
unknown
plain_text
2 years ago
745 B
8
Indexable
#include <Wire.h> #include <AS5600.h> // Adresy enkoderów AS5600 const byte encoderAddresses[] = {0x36, 0x37, 0x38, 0x39, 0x3A}; const int numEncoders = sizeof(encoderAddresses) / sizeof(encoderAddresses[0]); AS5600 encoders[numEncoders]; void setup() { Serial.begin(9600); Wire.begin(); // Inicjalizacja enkoderów for (int i = 0; i < numEncoders; i++) { encoders[i].begin(encoderAddresses[i]); } } void loop() { // Odczyt i wyświetlanie wartości z każdego enkodera for (int i = 0; i < numEncoders; i++) { int encoderValue = encoders[i].getPosition(); Serial.print("Encoder "); Serial.print(i); Serial.print(": "); Serial.println(encoderValue); } delay(500); // Pauza między odczytami }
Editor is loading...