Marcuswdf:
Hi, I would like to pose a question for the Arduino reference (Arduino Reference - Arduino Reference) regarding digitalRead command as I'm quite new to these c:May I know why is it so that when I wrote (under void setup)
Arduino uno
#include <LiquidCrystal.h>const int rs = 13, en = 12, d4 = 11, d5 = 10, d6 = 9, d7 = 8;
LLiquidCrystal lcd(rs, en, d4, d5, d6, d7);//VOID SETUP//
pinMode(2, INPUT);
pinMode(4, OUTPUT);
digitalWrite(2, LOW);
digitalWrite(4,HIGH);//VOID LOOP//
void loop(){
if (digitalRead(2) == HIGH){
lcd.clear();
lcd.print("TYPE: GAIN");
lcd.cursor(0, 1);
lcd.print("CLASS: 14");
delay(1000);
}
}The code above reads out the connection and lcd.prints on my display when I have set it to LOW + no connection was made between pin 2 & 4 (pin 2 & 4 are also untouched).
And also how do I resolve the matter and making sure I am able to read the connection properly through the if statement.
Thanks a bunch!!!
Where is setup() ? ? ?