Hello everyone.
I've been working on a project for over 3 years now, that consists out of building a massive joystick, with telemetry output (for now 7 gauges, and about 35 forms of status lighting).
In this project, most of the gauges are PWM driven through BC547 transistors with the input for these coming from the Mega2560.
But I have run into a problem:
The only gauge that differs from the way it is being driven is the speedometer, which internally is servo-driven, but the input is made through tone(); , receiving it's telemetry input from game information through a program called SimHub.
Yesterday I spent a LONG time figuring out why the brake pressure drum gauges ceased to function normally, and found that enabling the speedometer output is the problem.
The speedometer is on pin 13, the brake pressure for drum 1 is on pin 9, and brake pressure for drum 2 is on pin 10.
From all the documentation I can find, these pins are not in a trio with pin 13, pin 13 is, from what I can find, in a duo with pin 4.
Pin 13 being on timer OC0A and 0C1C, 10 on OC2A, and 9 on OC2B .
All PWM pins have internal timers changed to combat coil-whine, and flicker on a camera, should it happen I record the project on video.
These are changed with:
TCCR1B = TCCR1B & B11111000 | B00000011; // for PWM frequency change at D11 and D12
TCCR2B = TCCR2B & B11111000 | B00000001; // for PWM frequency change at D9 and D10
TCCR3B = TCCR3B & B11111000 | B00000001; // for PWM frequency change at D2, D3 and D5
TCCR4B = TCCR4B & B11111000 | B00000010; // for PWM frequency change at D6, D7 and D8
TCCR5B = TCCR5B & B11111000 | B00000010; // for PWM frequency change at D44, D45 and D46
The thing I did find is that the tone() function uses Timer0, which might influence the settings of other pins.
But I am pretty much lost on what the pin combination for Timer0 is in this case.
I know that pinduo's or trio's can't use PWM or tone at the same time, only one at the time, so this has thrown me a surprise.
I have been trying to find pin combinations by changing some of the pins, but since this is very much a finished project on this side, this is a very cumbersome, time-consuming way of fault-finding.
Should anyone have some pointers that explain to me the pin's affected by using the tone function on pin 13, I would really like the explanation.
I am scared I might have to ditch a gauge.
It's this cluster (heavily modified on the inside). Currently, the RPM Gauge is not functioning yet (it uses a chip I'm not sure how to drive correctly, there's no datasheet present on the internet for it).

