[Solved] Student First Project - Self Balanced Car

Hi everyone!
I am a graduate student of computer engineering and, for my thesis, I am doing an internship this Sel-Balanced Car.
The goal of my training is to establish a wireless connection between Arduino and Matlab, so as to make it to the latter some features of the demo (such as the Kalman filter). First I've tried to replace the Iteaduino UNO with the Arduino Yùn, but this wasn't able to withstand the 12 volts necessary to power the DC motors.
I wanted to know if keeping the Iteaduino UNO and, in addition to the Stabilizer Shield, using a Yùn Shield (to allow the wireless connection) this could modify the code or not and, if so, what would you suggest doing?

(the code in Arduino.txt was initially written for Arduino Yùn board)
Thank you for your time.

matlab.txt (4.42 KB)

Arduino.txt (8.15 KB)

I've tried to replace the Iteaduino UNO with the Arduino Yùn, but this wasn't able to withstand the 12 volts necessary to power the DC motors

This statement worries me.
Why would the arduino ever see motor power? I would think that only the motor driver and the motor ever see motor power. The arduino should only be powered with regulated power, either from a regulated source, or through the on board regulator, which in turn is powered by a source in the appropriate range.

arduino yùn does not have a voltage regulator like the other boards, so it can only be powered with a voltage of 5 volts (otherwise it would burn).

You can buy a voltage regulator.

I had already thought about it (even if I do not know how to mount it on the board), but I can not make structural changes on the boards, because they are owned by the university. Could you answer the question I asked you in the first topic, please?

Hello everyone!
I managed to solve the question on my own.
Thanks anyway.

Control loops have to be fast with constant low latency to be stable - talking back via WiFi to Matlab sounds like
a way to produce variable, unreliable, high latency step in the control loop, which isn't going to work well. The main control
loop should be local to the Arduino and run at a suitably high rate, several hundred Hz or so. Or perhaps you
meant that tuning and learning is off-loaded to host machine?