writing code thermoelectric cooler

the code for  project like a circuit which have two sensors at its two ends which connected to an arduino when  those to sensors will get higher temperature differnce they send signal to the arduino and then  the arduino send current to other device in this way it work as generator

secondly when we give voltage the it give arduino  a signal a it will trun on a fan for colling or a burner to raise the temperature.

and a video of the code working in simulation in TinkerCAD