const int potPin = A0; //Pot at Arduino A0 pin
//Variables:
int pot ; //pot from pot
void setup() {
//Start the serial communication
Serial.begin(9600); //Baud rate must be the same as is on xBee module
lcd.begin(16,2);
lcd.clear();
}
void loop() {
//Read the analog pot from pot and store it to "pot" variable
pot = analogRead(A0);
//Map the analog pot to pwm pot
pot = map (pot, 0, 1023, 0, 255);
//Send the message:
Please follow the advice given in the link below when posting code. Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination
What have you tried and where are you stuck ?
I assume that you want to detect that the pot reading has changed and in which direction. How much change should be regarded as significant ?
sorry for not displaying the code properly...
** What have you tried and where are you stuck ?**
then i will show you a video to understand my problem
Basically I want to show different levels of lighting.
The potentiometer levels are 0-255.
0 to 85 display on LCD "Low"
86 to 170 "Medium"
171 to 255 "High"
As we can see in the video, my problem is that it does not show the other levels, only "low" and it does not change