HoRoSim (Holistic Robotic Simulator) allows you to simulate physical devices controlled by Arduino code. The user defines standard electronic circuits that are employed in the Arduino code and CoppeliaSim simulates the physics of the device. Thus, HoRoSim simulates Arduino code with a physics engine and based on the electronic circuits defined. You can use the Arduino IDE to compile the code and run it.
Repository: https://bitbucket.org/afaina/horosim
Line following robot:

PID controller:

Video: https://bitbucket.org/afaina/horosim/sr ... roller.png
The simulator has been described in an article published on the 13th International Conference on 2021 Robotics in Education:
Faiña A. (2022) HoRoSim, a Holistic Robot Simulator: Arduino Code, Electronic Circuits and Physics. In: Merdan M., Lepuschitz W., Koppensteiner G., Balogh R., Obdržálek D. (eds) Robotics in Education. RiE 2021. Advances in Intelligent Systems and Computing, vol 1359. Springer, Cham. https://doi.org/10.1007/978-3-030-82544-7_24
Cheers,
Andres