Welcome! You don't need to modify my code to use it with 12v motors. If your power supply is 12v then the temperature will be the same as running a 5v motor with 5v PS. A 12v motor will of course have more torque and speed. With my "cool" functions you can use your 12v motor with a 18-24v power supply. Otherwise you will not need the "cool" functions. They are designed for running a 5v motor at 12v or a 12v motor at 24v.