The first rule when asking advice for code, is to post your existing attempt in CODE tags) so we can see where changes may be added,
For any requests about hardware design, it’s also advisable to put together an annotated schematic diagram, so we can see what you’ve done - and you’ll be able to fix it in the future !