How to display picture
-
Hello,
How do I display a picture to the screen (M5Stack) from the SD-Card.
I'm looking for an example.
Thanks for any help.Cheers,
Jan -
@powersoft said in How to display picture:
Hello,
How do I display a picture to the screen (M5Stack) from the SD-Card.
I'm looking for an example.
Thanks for any help.Cheers,
JanIn what programming language?
-
I use the arduino envoirment.
-
Hey @Powersoft you can try this tutorial which @Dimi wrote some time ago on our forums, I believe the information should still be relevant http://forum.m5stack.com/topic/49/lesson-1-2-1-lcd-how-to-create-image-array/2
-
@powersoft Maybe you find it interesting to know that there is a way of compiling a picture into your code so that you do not need an SD-card. This could make your solution more simple.
To do:
Download the UTFT-library from Rinky Dink Electronics (http://www.rinkydinkelectronics.com/library.php?id=51)
Extract the download and use the Tools\Imageconverter565.exe to convert the image to a .c file (select AVR board)
Open the .c file and change the line '#include <avr/pgmspace.h>' into '#include<pgmspace.h>'
Insert the following lines in the file (the values should be the same as the image, 320x240 is max for M5Stack):
const uint16_t imageWidth = 320;
const uint16_t imageHeight = 240;
Rename the .c file into .h (e.g. logo.c into logo.h) and place the file in the folder where the .ino-file for your project is
In your Arduino-program add the following line in the top (or the other filename you have chosen)
#include <M5Stack.h>
#include "logo.h"
In your Arduino-program add the following line in the 'setup'-function:
M5.Lcd.setSwapBytes(true);
In your Arduino-program add the following line in the place where you want to show the image:
M5.Lcd.pushImage(0, 0, logoWidth, logoHeight, logo);I have included a link to a small demo-file on the following page:
https://info.kosternet.nl/doku.php?id=publiek:m5stack
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login