How do I fix the error that says 'ledpin' was not declared in this scope?

I can't see your picture, but I can't see where you define 'val' or 'ledpin'