Several fixes

Repair the funciton that writes the frame on the cube.
Update the code to support 4 cubes at the same time
Update the code to reduce the number of pins necesarry from 22 to 7
Update the temp frame to make the computation of the frame faster