with the information you posted, the only answer you will get is: "it is simple, you just need to wire the parts correctly and then write the appropriate code"
with the information you posted, the only answer you will get is: "it is simple, you just need to wire the parts correctly and then write the appropriate code"