Hi,
I'm wondering if someone can make sense of some code and schematics regarding 2 LED lights in a circuit. I didn't create this code so I'm only trying to follow it.
The module i'm working on has 2 LEDs. One LED to represent power and the other LED to represent the system is ready. In the schematics its shows LED1 connected to 3.3v and the LED2 to D3. However, in the code it shows PinMode 2 & 3 as Output but only pin 3 as high. So correct me if i'm wrong, according to the schematics both LEDs would turn on? If so, would it be correct to put leds be on pin 2 and 3.
Also, assuming both LEDS turn on, would they just be doing the same function? As one of them is meant to indicate the system is ready.
Section of code for the LED
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
delay(500);
digitalWrite(3, HIGH);
Full Code
SoftwareSerial mySerial(4, 5);
RF24 radio(7, 8);
DFRobot_TFmini TFmini;
uint16_t distance;
const byte addr[6] = "00001";
void setup(){
Serial.begin(115200);
TFmini.begin(mySerial);
radio.begin();
radio.openWritingPipe(addr);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
delay(500);
digitalWrite(3, HIGH);
}
void loop(){
if(TFmini.measure()){
distance = TFmini.getDistance();
if(distance < 20000 && distance > 0) {
Serial.println(distance);
radio.write(&distance, sizeof(distance));
}
}
}
