display.setRotation is Squirrely with TCA9548A

Hello Experts,

I have an enigma. I am using two SSD1306 OLED displays (128 X 32) and multiplexing them with a TCA9548A. My data is multiplexed properly and I can select my displays (display1 and display2) calling them with TCA9548(0) and TCA9548(1) respectively.

My display1 OLED is used in both the non-rotated and rotated views.

I have used display1.setRotation(2) to successfully rotate (180 degrees) the display in the past but it no longer does so. What this means is that I have somehow defeated this command and I do not know what I did.

My entire sketch is over 2500 lines but an inoperative example of rotating the display is shown below. Everything prints as expected, except for the lack of rotation. If anyone has any suggestions for using display.setRotation that I am missing, please help me out. I see no reason why I cannot go back and forth all day from a rotated to a non-rotated SSD1306 as desired but , then again, I am posting here for help so I am making a bad assumption somewhere.

Thank you.

  if (counter < -90 && counter >= -170)  // Negative rotated display
  {counTer = -(counter + 180);     
  TCA9548A(0);
  display1.setRotation(2); OLED
  display1.clearDisplay();
  display1.setTextSize(2);
  display1.setTextColor(WHITE);  
  display1.setCursor(0,0);
  display1.print("ANGLE: "); 
  display1.println(counTer);
  display1.println("DEGREES");
  display1.display();}

What happens if you comment the work OLED

display1.setRotation(2); // OLED

Leo..

Nothing changed, but I was wondering about how [OLED] was added to my code when I had not placed it there. I guess it is just an unloading shorthand.

I am curious, however, what you expected to happen. I do not know much about coding (obviously) but my belief has always been that anything after [//] is ignored in totality. Please elucidate.

Nope, the display is just fine. The programmer / operator cannot properly map rotation from the breadboard to the finished device. I was complaining about why this code [above] wasn't rotating, but it was. I was referencing a random piece of code pulled out of a convenient orifice.

Thank you again for entertaining the possibilities - I thought I was wrong but I was mistaken;)-.

It is probably a bad assumption that the error is in the tiny snippet you posted, but there are two completely different variables in the line below:

counTer = -(counter + 180);

You would probably gain some insight by getting rid of about 2450 lines, in order to get a skeleton sketch with two displays and .setRotation() calls working correctly.

I appreciate that. Yes, "counTer" is uniquely different than "counter" for a reason. It turns out the squirreliness was a result of my learning to properly call and turn off the display codes necessary to activate the multiplexer.

So, basically, the error W

SO yes, the error WAS is the tiny snippet of code I provided but thank you for your response.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.