Would I need some type of circuit to actually do the sampling or could I do it all in code? Do you have an example?