Rotary encoder 377B with Teensy

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
elirosenblatt
 
Posts: 1
Joined: Fri Dec 12, 2014 3:23 pm

Rotary encoder 377B with Teensy

Post by elirosenblatt »

Trying to get the rotary encoder working with a Teensy 3.1 and I'm having a few issues. I'll try to explain them in as much detail as I can.

I'm using Arduino 1.0.6 on Mac OS 10.9.5 (having installed with Teensyduino 1.20).

Using the Basic Encoder Test example code, I'm able to see in the Serial Monitor that

Code: Select all

Serial.println(newPosition);
yields a positive or negative number, depending on which way I turn the dial of the rotary encoder. Yay!

However,

a) Every time I try to open the Serial Monitor, I get an error:

"Serial port '/dev/cu.usbmodem415891' not found. Did you select the right one from the Tools > Serial Port menu?"

Note that none of the other serial port options work at all, and I am indeed able to get the Serial Monitor window to come up, but only after reselecting "Serial Port" in the Tools Menu, and re-selecting Serial Monitor from the menu.

b) The program includes

Code: Select all

Serial.println("Basic Encoder Test:");
...Yet the Serial Monitor window does not show that text at any time. It simply starts showing increasing and decreasing numbers as I turn the dial left and right.

c) So moving forward, to better understand how to code for the rotary encoder, I try to load the program that the Adafruit site recommends for getting started with the rotary encoder, which itself is written not for the Teensy but for the Trinket. Not sure if that's an issue but even though I've got the necessary libraries loaded (triple-checked this, they are in there correctly I believe), Arduino software says:

TRINKET_forRotaryEncoder.ino: In function 'void loop()':
TRINKET_forRotaryEncoder:46: error: 'TRINKET_PINx' was not declared in this scope
TRINKET_forRotaryEncoder:46: error: 'bit_is_clear' was not declared in this scope
TRINKET_forRotaryEncoder:49: error: 'TRINKET_PINx' was not declared in this scope
TRINKET_forRotaryEncoder:49: error: 'bit_is_clear' was not declared in this scope
TRINKET_forRotaryEncoder:85: error: 'bit_is_set' was not declared in this scope
TRINKET_forRotaryEncoder:112: error: 'TRINKET_PINx' was not declared in this scope
TRINKET_forRotaryEncoder:112: error: 'bit_is_set' was not declared in this scope

Ultimately, I want to have the Rotary Encoder controlling LEDs (turning on one at a time, and then every 30 leaving one additional one lit up) on the 12mm Diffused Thin Digital RGB LED Pixels - which I got in the mail and played around with and which are SO COOL!

Any recommendation for troubleshooting any / all of these issues would be so appreciated.

Thanks tons Adafruiters!

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Rotary encoder 377B with Teensy

Post by Franklin97355 »

As you have found you can't run Trinket code on a Teensy. They are two different chips and as such have different core libraries.

User avatar
paulstoffregen
 
Posts: 444
Joined: Sun Oct 11, 2009 11:23 am

Re: Rotary encoder 377B with Teensy

Post by paulstoffregen »

In Arduino, use File > Examples > Encoder > Basic to get started.

If "Encoder" is missing, run the Teensyduino installer again, and on the page to add libraries, click the checkbox for "Encoder".

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”