Hi, I'm quite new to Arduino and Iam making 16x2 LCD using autoscroll function because values range 0-9999 from potentiometer and contrast adjust to digital pin 6 , pot pin connected to A0 and setcursor also used in lcd but unwanted characters generated like 3cS# and also im displayed in 156 serial monitor but in lcd 1560 generated and adjusting pot values slowly generated in lcd and I'm setting cursor (5,0) but sometime values displayed in (0,0).
In the Arduino IDE, use CtrlT or CMDT to format your code then copy the complete sketch.
Use the < CODE / > icon from the ‘posting menu’ to attach the copied sketch.
int potPin = analogRead(A0);
int potData = map(potPin, 0, 9999, 0, 1023);
Tell us what you think is happening in the lines of code above.
Sir, autoscroll option also there for serial monitor and Im using lcd 0 to 9999 values generated in both lcd and serial monitor but unwanted characters generated in lcd , eg: #3scS, cursor change (5,0) to (0,0) , 143 generated in serial monitor but in lcd generated 1430 or 1439
Since analogRead(A0) returns a value between 0 and 1023, could you please explain why your sketch then tries to map the returned value from [0..9999] to [0..1023]? I have pondered that piece of code at length and I find it puzzling.
I want to display 0 - 9999 values in lcd to adjust the pot , I know pot A0 values range from 0 to 1023 but I want to display 0 - 9999 both serial monitor and lcd
Consider the 16 bit ADS1115, it's aref voltage is 6.144V, if you put 0 ~ 5V on it's input it will return a value of 0 ~ ( 5 / 6.144 * 32767) = 26664.
So, maxADCvalue would be the value read when 5V is applied to the input.
9999 / 26664 = 0.375. So if you put 5V on the input you would have 26664 returned, multiplied by 3 / 8 would print 9999.