From cae96de985c523d06bf4460a7c853ee2d22e2cf9 Mon Sep 17 00:00:00 2001 From: SquadQuiz Date: Tue, 16 Jan 2024 11:38:56 +0700 Subject: [PATCH] add teensy demo example --- .../AS5600_demo_Teensy/AS5600_demo_Teensy.ino | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 examples/AS5600_demo_Teensy/AS5600_demo_Teensy.ino diff --git a/examples/AS5600_demo_Teensy/AS5600_demo_Teensy.ino b/examples/AS5600_demo_Teensy/AS5600_demo_Teensy.ino new file mode 100644 index 0000000..c51bd19 --- /dev/null +++ b/examples/AS5600_demo_Teensy/AS5600_demo_Teensy.ino @@ -0,0 +1,45 @@ +// +// FILE: AS5600_demo_Teensy.ino +// AUTHOR: Rob Tillaart, SquadQuiz +// PURPOSE: demo +// +// tested compilation with Teensy 4.1 + +#include "AS5600.h" +#include "Wire.h" + +AS5600L as5600(AS5600_DEFAULT_ADDRESS); // 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. + int b = as5600.isConnected(); + Serial.print("Connect: "); + Serial.println(b); + delay(1000); +} + + +void loop() +{ + // Serial.print(millis()); + // Serial.print("\t"); + Serial.print(as5600.readAngle()); + Serial.print("\t"); + Serial.println(as5600.rawAngle()); + // Serial.println(as5600.rawAngle() * AS5600_RAW_TO_DEGREES); + + delay(1000); +} + + +// -- END OF FILE --