Cant get readlightsensor to work in mbed

I can get the light sensor to work in javascript but I have been unable to get it to work in mbed with uBit.

When I call readlight sensor I only get the value 255.
The documentation says I should get zero on the first call.

I have tried calling it twice with a wait between calls to set the mode

Do I have to access it via messaging?