Yes. There is nothing specific to M5Stack. Which exact model do you have? The M5Stack example will reference a library and M5.LCD. display references which may be confusing to an Arduino. Are you programming in Arduino IDE?