5. Given the function $f(x)=4 \sin 2 x+3 \cos 2 x+2 a \sin x+4 a \cos x$ has a minimum value of -6, then the value of the real number $a$ is
$\qquad$.
$$
\begin{array}{l}
f(x)=4 \sin 2 x+3 \cos 2 x+2 a \sin x+4 a \cos x \\
\Rightarrow 6 \cos ^{2} x+8 \sin x \cos x+2 a(\sin x+2 \cos x)-3,
\end{array}
$$

Let $t=\sin x+2 \cos x \in[-\sqrt{5}, \sqrt{5}]$, then $t^{2}=4 \cos ^{2} x+4 \sin x \cos x+\sin ^{2} x$
$$
=3 \cos ^{2} x+4 \sin x \cos x+1 \Rightarrow f(x)=2 t^{2}+2 a t-5 \text {. }
$$

Thus, $f(x) \geqslant-6 \Rightarrow 2 t^{2}+2 a t+1 \geqslant 0$, taking $t= \pm 1 \Rightarrow a \in\left[-\frac{3}{2}, \frac{3}{2}\right]$
$$
\Rightarrow-\frac{a}{2} \in[-\sqrt{5}, \sqrt{5}] \Rightarrow \Delta=4 a^{2}-8=0 \Rightarrow a= \pm \sqrt{2}
$$