joshnishikawa / MIDIcontroller

A library for creating Teensy MIDI controllers with support for hold or latch buttons, potentiometers, encoders, capacitive sensors, Piezo transducers and other velocity sensitive inputs with aftertouch.
223 stars 19 forks source link

Teensy 4 and Touch #6

Closed Troub99 closed 1 year ago

Troub99 commented 4 years ago

Hi Josh I'm building a midi controller with encoders and buttons. I'm attempting to use a Teensy 4 along with your library. I can compile the sketch in Arduino IDE for Pots and Encoders, but the button example gives me this error with the Teensy 4 (it compiles fine for Teensy 3.6):

Arduino: 1.8.11 (Mac OS X), TD: 1.51, Board: "Teensy 4.0, MIDI, 600 MHz, Faster, US English

/var/folders/j0/v7q8w86j5lqfx_ph7blxdf600000gn/T/arduino_build_188966/libraries/Flicker-master/TouchSwitch.cpp.o: In function TouchSwitch::trigger()': Documents/Arduino/libraries/Flicker-master/TouchSwitch.cpp:88: undefined reference totouchRead' collect2: error: ld returned 1 exit status Error compiling for board Teensy 4.0.

I've been trying to take the touch functions out of the library and button files as I don't need them for this project. I feel I've been getting close, but no success so far. Can you help at all with how I can modify the button.h and button.cpp files? Thank you.

joshnishikawa commented 4 years ago

Thank you! The MIDIbutton class supports capacitive touch but Teensy 4.0 doesn't. I'll have to throw some 'if' statements in there. Stand by.

joshnishikawa commented 4 years ago

I put a band-aid on the MIDIbutton and MIDIdrum read functions so that anything that references touchRead() is only compiled if the board is not a 4.0. I'll leave this issue open until I have an opportunity to fix it properly but, for now, it should compile and run just fine for Teensy 4.0 users who are just trying to use normal buttons and piezo/FSR drums. Please let me know if it doesn't as I can only compile the code. I don't actually own a 4.0 to test myself :^(

Troub99 commented 4 years ago

That's fantastic, thank you. I'll give it a go and report back.


From: joshnishikawa notifications@github.com Sent: 10 March 2020 06:47 To: joshnishikawa/MIDIcontroller MIDIcontroller@noreply.github.com Cc: Troub99 stevewhite99@hotmail.com; Author author@noreply.github.com Subject: Re: [joshnishikawa/MIDIcontroller] Teensy 4 and Touch (#6)

I put a band-aid on the MIDIbutton and MIDIdrum read functions so that anything that references touchRead() is only compiled if the board is not a 4.0. I'll leave this issue open until I have an opportunity to fix it properly but, for now, it should compile and run just fine for Teensy 4.0 users. Please let me know if it doesn't as I can only compile the code. I don't actually own a 4.0 to test myself :^(

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/joshnishikawa/MIDIcontroller/issues/6?email_source=notifications&email_token=AOY5BAOJKHZH23JNRZG3LS3RGXO6TA5CNFSM4LEQGDBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOKG4EI#issuecomment-596930065, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOY5BAK56PN6UKQCFGLVWU3RGXO6TANCNFSM4LEQGDBA.

Troub99 commented 4 years ago

Working fantastically with Teensy 4 now, thank you. I expanded your MIDIEnc example to 8 rotary encoders with switches and my controller is now flying. I am extremely grateful.