Hello,
I’m trying to program a Arduino Mega screen and having some problems i was wondering if anyone could lend a hand.
I have 2 problems:
Problem 1: using these library #include <dht11.h> #include <Servo.h> #include <UTouch.h> #include <UTouchCD.h> #include <UTFT.h> #include <memorysaver.h>
i am trying to shift the text that I’m writing on screen left and right. I can shift up and down that’s easy just not left and right. Here is the line of code im using:
myGLCD.print(fred, LEFT, 50);
So it prints fred on the left of the screen and 50 pixels down. Got that. However i cant move right a little. if i add (, 20) on the end it rotates the text through 20 degrees.
Any help would be much appreciated.
Second problem is that im trying to get the “fred” part of that statement to be a changing value int. Its a temperature that i want to refresh every 10 seconds taken from a temperature sensor. i have the sensor working correctly i just cant get the compiler to agree to display an int on the screen. it says it needs to be a const car or a String.
Again any help would be appreciated.
Releah
P.S. the program im working on is attached in case you want to see the actual code
So it prints fred on the left of the screen and 50 pixels down. Got that. However i cant move right a little. if i add (, 20) on the end it rotates the text through 20 degrees.
You could provide a link to the library, so we can see what options are available.
Second problem is that im trying to get the "fred" part of that statement to be a changing value int. Its a temperature that i want to refresh every 10 seconds taken from a temperature sensor. i have the sensor working correctly i just cant get the compiler to agree to display an int on the screen. it says it needs to be a const car or a String.
I wonder what would happen if you used itoa() to convert the int to a string...
I would suggest that you have a read of the Manual which has very kindly been witten by Henning - you can find it here Electronics - Henning Karlsen.
The format for the print function is :
print(st, x, y [, deg]);
You can use the literals LEFT, CENTER and RIGHT as the x coordinate to align the string on the screen - if you want to use different coordinates then you will need to specify both the x and y cordinates.
For your second question you may wish to have a look at the difference between the Print, printNumI and printNumF functions.