THIS WEBSITE/DOMAIN IS FOR SALE
Email: restomaguio@yahoo.com
Kits and Gadgets Inc.
FARWANIYA, Farwaniya, 80003
Kuwait
ph: +965 67060813
kits
The schematic diagram below is a simple circuit on how to connect an LED to NodeMCU. As shown in the diagram, the anodes are connected to positive line or B+ but by reversing the LED connection to the resistor, it is possible to get the same result provided that the cathode of the LEDs are connected to the GROUND terminal instead of the B+ terminal.
However, in such case, a minor modification of the program is needed to have the same effect. In the program, the command to put the GPIO terminals to LOW state is initiated to activate each LED since the LED anode terminal is connected to the positive rail.
So, instead of LOW command, it should be HIGH (as shown) if the LEDs are connected in reverse way or all cathodes connected to the GROUND.
MODIFIED PROGRAM:
digitalWrite(05, HIGH); // turn the LED on (LOW is the voltage level)
delay(100); // wait for a second
digitalWrite(05, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for a second
DIAGRAM
PROGRAM
/*
Experiment No.4
By: Rolando Estomaguio
Radar Specialist - Electronics Engineer
http://www.kits-gadgets.com
Objective: To learn the operation of WeMOS NodeMCU and utilize its full functionality.
Title: Running 8 LEDs
Description: Turns ON & OFF 8 LED in sequence repeatedly.
*/
// The 8 LED runs continuously with interval depending on the value of delay.
void setup() {
// initialize digital pin 5, 4, 0, 2, 14, 12, 13 and 15 as an output.
pinMode(05, OUTPUT);
pinMode(04, OUTPUT);
pinMode(00, OUTPUT);
pinMode(02, OUTPUT);
pinMode(14, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(15, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(05, LOW); // turn the LED on (LOW is the voltage level)
delay(100); // wait for a second
digitalWrite(05, HIGH); // turn the LED off by making the voltage HIGH
delay(100); // wait for a second
digitalWrite(04, LOW); // turn the LED on (LOW is the voltage level)
delay(100); // wait for a second
digitalWrite(04, HIGH); // turn the LED off by making the voltage HIGH
delay(100); // wait for a second
digitalWrite(00, LOW); // turn the LED on (LOW is the voltage level)
delay(100); // wait for a second
digitalWrite(00, HIGH); // turn the LED off by making the voltage HIGH
delay(100); // wait for a second
digitalWrite(02, LOW); // turn the LED on (LOW is the voltage level)
delay(100); // wait for a second
digitalWrite(02, HIGH); // turn the LED off by making the voltage HIGH
delay(100); // wait for a second
digitalWrite(14, LOW); // turn the LED on (LOW is the voltage level)
delay(100); // wait for a second
digitalWrite(14, HIGH); // turn the LED off by making the voltage HIGH
delay(100); // wait for a second
digitalWrite(12, LOW); // turn the LED on (LOW is the voltage level)
delay(100); // wait for a second
digitalWrite(12, HIGH); // turn the LED off by making the voltage HIGH
delay(100); // wait for a second
digitalWrite(13, LOW); // turn the LED on (LOW is the voltage level)
delay(100); // wait for a second
digitalWrite(13, HIGH); // turn the LED off by making the voltage HIGH
delay(100); // wait for a second
digitalWrite(15, LOW); // turn the LED on (LOW is the voltage level)
delay(100); // wait for a second
digitalWrite(15, HIGH); // turn the LED off by making the voltage HIGH
delay(100); // wait for a second
}
Copyright 2013 Kits and Gadgets Electronics Inc. All rights reserved.
Kits and Gadgets Inc.
FARWANIYA, Farwaniya, 80003
Kuwait
ph: +965 67060813
kits