My speedometer is only working sometimes. It will work for a few days fine, then all of sudden stop…

My speedometer is only working sometimes. It will work for a few days fine, then all of sudden stop working back and forth. I tried what you suggested and when it wasn't working I plugged a obc2 to my computer and it read the speed fine so I don't think the sensor is bad. Any idea what it could be?

false