Skip to content

Commit

Permalink
add teensy demo example
Browse files Browse the repository at this point in the history
  • Loading branch information
SquadQuiz committed Jan 16, 2024
1 parent 5134633 commit cae96de
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions examples/AS5600_demo_Teensy/AS5600_demo_Teensy.ino
Original file line number Diff line number Diff line change
@@ -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 --

0 comments on commit cae96de

Please sign in to comment.