So here is what I’m doing. I have six printer carriages that each have an encoder strip, quadrature encoder and DC motor. For each of these, I have an arduino uno serving as a position decoder and motor controller. The arduinos are I2C slaves to a Teensy 3.5 board which requests the position from the Unos, receives midi notes which dictate the next position to set the carriages at, and sends commands to the uno to tell it what to set the PWM to and what DOs to toggle. I am able to read the encoders via I2C in an earlier version of my code.
Now since each printer carriage can have a different travel length, lines per inch of the code strip, and MIDI note offset, I thought it would greatly organize my sketch create a class to handle those properties and also the methods for sending that information via I2C. I then followed the arduino site’s tutorial for creating a library. After getting it how I wanted it, I put the header and cpp files in an appropriately named folder in the arduino libraries directory, revised my Teensy 3.5 sketch to use the library, Verified, addressed all the errors in the sketch and library files, and now it can be verified without any errors showing. I uploaded my code to the teensy while it was connected to the Unos via I2C to read the encoders, but I was not getting the encoder positions to print in the Serial window like I was expecting. In fact, after unplugging the Teensy entirely from the circuits, adding Serial.println(“SETUP”); to the beginning of setup(), and reuploading, it appears that my setup function isn’t being executed at all.
I’m certain I’ve made a mistake in my library, but without anymore compiler warnings to work from, I’m not sure how to troubleshoot this issue. Can you help me figure out what’s wrong in my code?
Teensy 3.5 configured as a USB Type: MIDI - Maestro.ino and Maersto_old
Library: DiddleyBow.h and .cpp
Arduino Uno: Decotor.ino
Maestro_old.ino (2.38 KB)
Maestro.ino (4.29 KB)
DiddleyBow.h (1.53 KB)
DiddleyBow.cpp (2.43 KB)
Decotor.ino (2.52 KB)