The pinouts of the m5stack are similar to most esp32 dev boards, perhaps this tutorial will help https://www.youtube.com/watch?v=a7DrFqqu-78&feature=youtu.be