Hi,
This is to be expected, as our tutorial is for the STM32F407VG device. Copying device-specific code into a project targeting a different device will indeed most likely result in various errors.
That said, different STM32 families use fairly similar APIs, so porting the code between them should be fairly easy, as long as you understand the differences between them. Looking through ST documentation/samples could be a good starting point.