Content originally posted in LPCWare by kralux on Wed Oct 05 00:40:01 MST 2011
Found out that this code works really well actually.
The main issue was that my LPC1788 had gone bad because of an accidental potential on one of the ADC pins (4.5V) which ended up killing the ADC internals and it would always return 0.