I need help with code!

The OP did say he was posting two attempts "I made 2"...so it's not surprising there are two loop()s. There are also two setup()s.

So we have two separate programs. Do either of them compile and load and do anything useful? If so choose the one that is nearest to doing what you want, test it, post just that one correctly using </> code tags. Then tell us exactly what it does and what you want it to do that it doesn't yet do.

Then we can maybe offer some real help.

Steve