I do not know what .set(3, ...) means: I use it as:
digitalWrite(LEDG, OFF);
When you want to see a GPIO output - you have to configure as output (default is input):
pinMode(LEDG, OUTPUT); // Set green LED as output
I am not familiar with this pin numbering (my LEDG is 166 as a value, how?). I use often directly the HAL code where the pins is specified as GPIO_PIN_x and GPIOy
I would guess, you have not configured as an output (?)
Attached my GPIO_usr files for using GPIOs directly via STM HAL functions: GPIO_usr.h (1.0 KB) GPIO_usr.cpp (3.2 KB)