Pham Quỳnh
New member
What is the output of the output on the Serial Monitor for the program given below if the input supplied to pin1 is of the form 0111?
A. -1 0 1 1
B. -1 0 0 1 0 1 0
C. 1 0 1 1 0 1 1
D. -1 1 1 0 1 1 0
Code:
int pin1=11;
void setup() {
pinMode(pin1,INPUT);
Serial.begin(9600);
}
void loop() {
if(digitalRead(pin1)==1) {
Serial.print(“1 0”);
}
else {
Serial.print(“-1 0”);
}
}
B. -1 0 0 1 0 1 0
C. 1 0 1 1 0 1 1
D. -1 1 1 0 1 1 0