We report a scanning probe technique that can be used to measure charging of localized states on conducting or partially insulating substrates at room temperature under ambient conditions. Electrostatic interactions in the presence of a charged particle between the tip and the sample is monitored by the second order flexural mode, while the fundamental mode is used for stabilizing the tip-sample separation. Cycling the bias voltage between two limits, it is possible to observe hysteresis of the second order mode amplitude due to charging. Results are presented on silicon nitride films containing silicon nanocrystals. (c) 2008 American Institute of Physics.