I wrote a program to read digital input from pins 36, 37, 38 and print on LCD when they go HIGH. I've connected those pins to a switch to test.
The program looks like this:
#include "LiquidCrystal.h"
// initialize the library by providing the nuber of pins to it
LiquidCrystal lcd(8,9,4,5,6,7);
int vswr,th,od,a;
void setup() {
pinMode(36,INPUT);//SENSING VSWR
pinMode(37,INPUT);//SENSING THERMAL
pinMode(38,INPUT);//SENSING OVER DRIVE
pinMode(35,OUTPUT);//BYTE_CTRL SIGNAL TO SHUTDOWN
digitalWrite(35,LOW);
}
void loop() {
vswr = digitalRead(36);
th= digitalRead(37);
od = digitalRead(38);
lcd.begin(16,2);
// set cursor position to start of first line on the LCD
lcd.setCursor(0,0);
if (vswr==1) {
lcd.write("vswr");
digitalWrite(35,HIGH);
delay(2000);
}
if (th==1) {
lcd.write("thermal");
digitalWrite(35,HIGH);
delay(2000);
}
if (od==1) {
lcd.write("over drive");
digitalWrite(35,HIGH);
delay(2000);
}
}
When I run this, the LCD continuously displays:**
vswrthermaloverdrive
Even though none of the pins are high.
When I use Pins 11, 12, 13 instead of 36, 37, 38 it works fine. I already used pins 11,12,13 for some other purpose. Why is this happening? And how do I solve this problem?