Reading the value I see on the oscilloscope

There is sample pic code.
how can i adapt it for arduino