Today, thanks for joining me here today were going to be talking about using the 4 inch wave share lcd graphics screen on an arduino im, going to discuss the difference between a screen and an hmi, in this case, its a screen, which means that everything that youre Looking at over here is done in software. All those lines, the circles, the squares and so on are written in code, its different to an hmi where you design the thing in an editor and download to the hdmi here, its just a screen, thats it plugged onto the back of the arduino. The benefit of this is that these screens are cost effective, the if youre not planning to use images and so on and only graphics. Then this becomes quite nice. It is a touch screen which means that it reports where youve touched it to the arduino, and then you can then use that in your code, so theres a screen over there. This was me messing around with a little sample project, which is a refrigeration orientated high pressure and low pressure switch controller, so heres our code for it we uh arduino uno selected. I dont have it plugged in at the moment, so it doesnt show the port so lets not fruit about that up at the top, then libraries, arduino, sbi, adafruit and wave share libraries that need to be included. Underneath here we have assigned hex values to the colors. So in the code we just call up the colors as we need them in our code, so in the namespace we declare the wave shield and then we start with our code.

This is code that executes once so. For the start, we turn on spi wave field. Initialization and then make the entire screen black, and then we start drawing our lines onto the screen in the in the various colors that we want, as well as the circles that we want, so everything that youre looking at on the right hand side. There is this code on the left hand side here so looking at those numbers, the full circle, thatll be the um, the origin, the diameter and the whether you want it to be an oval or a circle, make sure that weve got our rotation set to one. We select text size, two and select text, color, blue and then we print the suction pressure to the top then set the cursor to the next position and print head pressure. So over here all our text. We were writing to the screen as a print command. We specify the x and y comma coordinates, so youve got your x and your y and then we print the text that we want and then for some icons below theres, a retic, rectangle theres, a triangle and some circles that are added in. So you specify the coordinates the size, so you got x y and your diameter of your circle same with the rectangle. You got x y begin x y end. Then we make sure once again that rotation of the screen is set to 1.. Now were going to assign analog input 1, the sensor pin and the value that we read in goes to sensor value.

So since a value after being reading on analog input, 0 becomes sense of value and now set our text color to sign. I set the cursor to x, naught y60. We then scale that value and print it out, so it sends the value divided by 204.6. We scaled it then, after that we print the space and the bar. So on the screen, you see the analog value, followed by static text, which is your bar value. After that we have a delay of a second so that the sensor is displayed for a second. Then we overwrite that, with that black rectangle, that scrubs it out and makes it disappear. Well, we wait for a second after that and then we repeat the process, a right sensor, value to the screen again and that results in it flashing, looking as though its flashing. So thats how you would do a flashing symbol or an icon on the screen, youve physically got to write every pixel youve got to put the delays in youve got to overwrite the pixel when you want to make something disappear, because this is a screen, its not An hmi so therefore it doesnt do any of this stuff, for you youre doing it all in code, which is its not a bad thing. If you want, if youre doing something simple, also from a coding point of view, its quite a useful thing to to do its a good experience, this is just a basic introduction to how you do things with the wave share.

How you you youve, got to declare the libraries youre going to use then. Basically, your setup task, all the background, graphics get written. You know you select, you know your color selection, um, full circle, draw line, draw rectangle, draw triangle, and so on. Those are the commands that you use and you make things appear on the screen once you get used to this and familiar with this, its straightforward and quite nice to use its a nice screen to work with it is spi, so it does take up quite a Bit of the arduinos time, it makes it work quite hard, so you shouldnt expect a lot of things to happen quickly on the screen. Be aware of that. So, if youre changing something make sure that its small small changes that you write to the screen at a time and for the rest thats pretty much all i have to say about the screen plugs onto the arduino power it up and you can play with it. On the internet, theres theres more examples, adafruit has got some good examples attached to the library that one can use so for the rest, hope you learned something hope youre gon na do your own. With this have a wonderful day further.

https://www.youtube.com/watch?v=lgbURgexDAw