Selfbalancing robot doesn't react fast enough when falling

To start with, it is not posted here

Please follow the advice given in the link below when posting code . Use code tags when posting code here to make it easier to read and copy for examination