mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-09-12 09:36:59 +00:00
53 lines
1012 B
Arduino
53 lines
1012 B
Arduino
//
|
|
// FILE: AS5600_angular_speed.ino
|
|
// AUTHOR: Rob Tillaart
|
|
// PURPOSE: demo
|
|
// URL: https://github.com/RobTillaart/AS5600
|
|
//
|
|
// Examples may use AS5600 or AS5600L devices.
|
|
// Check if your sensor matches the one used in the example.
|
|
// Optionally adjust the code.
|
|
|
|
|
|
#include "AS5600.h"
|
|
|
|
|
|
AS5600L as5600; // use default Wire
|
|
|
|
|
|
void setup()
|
|
{
|
|
Serial.begin(115200);
|
|
Serial.println(__FILE__);
|
|
Serial.print("AS5600_LIB_VERSION: ");
|
|
Serial.println(AS5600_LIB_VERSION);
|
|
|
|
Wire.begin();
|
|
|
|
as5600.begin(4); // set direction pin.
|
|
as5600.setDirection(AS5600_CLOCK_WISE); // default, just be explicit.
|
|
|
|
Serial.println(as5600.getAddress());
|
|
|
|
// as5600.setAddress(0x40); // AS5600L only
|
|
|
|
int b = as5600.isConnected();
|
|
Serial.print("Connect: ");
|
|
Serial.println(b);
|
|
|
|
delay(1000);
|
|
}
|
|
|
|
|
|
void loop()
|
|
{
|
|
// Serial.print("\ta = ");
|
|
// Serial.print(as5600.readAngle());
|
|
// Serial.print("\tω = ");
|
|
Serial.println(as5600.getAngularSpeed());
|
|
delay(25);
|
|
}
|
|
|
|
|
|
// -- END OF FILE --
|