Go Down

Topic: Mayhew rotary encoder LED ring (Read 1 time) previous topic - next topic

So I got a Mayhew Labs rotary encoder LED ring, and I'm intending to use it to indicate an internal value on my Arduino Nano as part of a GPS project I'm working on. I've seen a bunch of videos displaying that you don't need a mounted potentiometer to use this chip, but I've yet to replicate their effects at all.

Currently, I have a blue LED ring mounted to the Nano as such:

  • GND to GND
  • VCC to 5V
  • ENCA, ENCB, and SWITCH are not used
  • SDI to D2
  • CLK to D3
  • LE to D4
  • OE and SDO are not used
The Nano and LED ring are fresh out of the box, untampered with and multimeter readings support that they're working fine. The Nano is running the following code for testing purposes, modified from a Mayhew example code for the chip to remove the potentiometer from the mix:
Code: [Select]
//These are the pins that will talk to the shift register through SPI
#define SDI    2    //Data
#define CLK    3    //Clock
#define LE     4    //Latch

// Global variables
int sequenceNumber;   //The output sequence for the LEDs
int Cap = 15;
int counter = 5;
int inc = 1;

unsigned int sequence[3][16] = {

void setup()
  //Set SPI pins to output
  pinMode(SDI, OUTPUT);
  pinMode(CLK, OUTPUT);
  //Set serial rate, prompt for desired sequence
  Serial.println("Enter 1, 2, or 3 to change the LED sequence");

void loop()
  //Get any serial input
  if (Serial.available() > 0) {
    int incomingByte = Serial.read();
    if (incomingByte == '1') {
      Serial.println("Sequence 1 selected!");
    if (incomingByte == '2') {
      Serial.println("Sequence 2 selected!");
    if (incomingByte == '3') {
      Serial.println("Sequence 3 selected!");
  if(sequenceNumber >= 0) {   
    if(counter >= 15 || counter <= 1){
      inc *= -1;
    counter += inc;
    int scaledCounter = map(counter, 0, Cap, 0, 15);
    //Send the LED output to the shift register
      shiftOut(SDI,CLK,MSBFIRST,(sequence[sequenceNumber][scaledCounter] >> 8));    //High byte first
      shiftOut(SDI,CLK,MSBFIRST,sequence[sequenceNumber][scaledCounter]);           //Low byte second


Go Up