distance sensor and timing

DMAG:
Its not working :neutral_face:

. . is probably the single least-liked phrase on this forum.
That, and posted screen-shots.

When you've fixed that, there'll be the problem that "n" isn't declared either.