-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nodemcu v2 pinmapping are outputting to the wrong pins #584
Comments
NodeMCU has weird pin mapping. static const uint8_t D0 = 16;
static const uint8_t D1 = 5;
static const uint8_t D2 = 4;
static const uint8_t D3 = 0;
static const uint8_t D4 = 2;
static const uint8_t D5 = 14;
static const uint8_t D6 = 12;
static const uint8_t D7 = 13;
static const uint8_t D8 = 15;
static const uint8_t D9 = 3;
static const uint8_t D10 = 1; These are defined here. If you want to use NodeMCU pin 5, use |
Awesome. Thankyou so much. Cheers |
for others with the same issue that made it here, the pinouts can be found here: https://github.com/esp8266/Arduino/blob/master/variants/nodemcu/pins_arduino.h#L37-L59 |
Hello, First of all thanks for all your work, without that I could not do this small project on university.
Based on a code made available on hobbytronics.co.uk. The code it's very incomplete at the moment, but the idea it's to create a flow meter, where I can get information from the flowmeter into a pin of the nodemcu, I'm using the pin "D2", but I'm not sure if this is correct. Do I have to initialize this variables in my code?
At the moment I only get 1's an 0's on Arduino Ide serial monitor. So when I send some air or water throught the flowmeter, the info on the monitor changes from zero to one, repeatedly. |
The flowmeter sends pulses - "Flow rate pulse characteristics: Frequency (Hz) = 7.5 * Flow rate (L/min)" - you need to count them (a variable that gets increased by one every pulse), divide by some time interval and output the result. At the moment you just display each pulse separately... Edit: flow_frequency divided by some time (or reset every n miliseconds) is what you want to get out. |
GPIO16 does support PWM. |
I stand corrected, igrr! That was a fast response! Continuing with igrr's comment... Another way to define Arduino friendly names to the ESP8266 GPIO pins is to use
The advantage of using the #define commands is that they use up no memory in the compiled sketch. Feel free to strip out the comments as well. I have a WeMos/LoLin NodeMCU that I bought a week ago and have been playing around (having played with the WeMos D1 board for a few weeks earlier). In testing the NodeMCU, I found out that the RX0 and TX0 pins are on D9 (GPIO3) and D10 (GPIO1) and they were not give names like D0 and D1 because these 2 pins are essentially reserved for Serial console communication. So, of the 11 GPIO pins (and ignoring the 5 GPIO pins used internally by the ESP8266 SoC (i.e. GPIO6, 7, 8, 9, 10 & 11)) that leaves only 9 GPIO pins which conveniently falls within the range of D0 and D8, and so were labeled this way. The I2C Bus signals SCL and SDA have been assigned to D1 and D2 (GPIO5 & GPIO4) while the four SPI Bus signals (SCK, MISO, MOSI & SS) have been assigned to GPIO pins 14, 12, 13 and 15, respectively). That leaves just 3 pins unassigned D0, D1 and D4. Not much to play with. I guess we need to focus on I2C and SPI compatible devices when interfacing modules to this NodeMCU board. However, the speed of the ESP8266 and convenience of WiFi should make this a popular alternative to the Arduino Uno and Arduino Nano. Now on to reliability testing... |
How I can use the GPIO module with Arduino IDE? and not have the problem; |
==> arlaor
The numbers (16, 4, 5) are GPIO pin numbers, and if you have a NodeMCU, these pins are most likely labeled D0, D1, D2... D8. But the Arduino development system needs to be told how to relate the "Arduino Friendly" pin names to the GPIO pin numbers. There are a couple ways to do this: either define D0 thru D8 as integer variables and initialize them to the GPIO pin numbers, or (my favorite way) use the C pre-processor command #define as shown below: #define D0 16 // Defines "D0" as "16" When you compile your code the pre-processor will go thru and substitute in "16" wherever there is a "D0". So, Arduino users don't have to worry about looking up GPIO pin numbers and such, just define it one time and include it in their source file. The examples you gave (shown again below) do not look like Arduino "C" code unless there is some kind of library where a gpio object has been defined and it includes a "mode" member function.
So, if I were to rewrite your code, I'd write something like:
Try to compile this version. I believe it will work. Also, look under Arduino IDE's File/Examples/Basics for some examples sketches to clue you into how to write "sketches" (C programs) using the Arduino IDE. Also, they have some ESP8266 example sketches under File/Examples/ESP8266. Hopefully this will put you on the right track. -WRM |
==> randmor My problem is this: I have occupied all the pins of my board and when I use the pins GPIO3 (RX) and GPIO1 (TX) to control the switching on and off of leds by IR receiver sensor connected to GPIO14 (D5), my nodemcu not respond to commands and LEDs remain always on, as if they lost the instruction and remain always LOW HIGH. When I use only the RX and TX pins as OUTPUT without connecting anything else on the board, they receive the HIGH and LOW commands, but when used in conjunction with other pins, these do not work and remain ON I expected by instruction gpio.mode () would obtain solution to this problem, but from what I understand, they are equivalent to pinMode () commands. questions: Is there any way to conver most of the pins (CLK, SD0, CMD, SD1, SD2, SD3, RX and TX) in pins OUTOUT/INPUT? by firmware or any module |
I have also noticed some odd behavior when trying to use GPIO3 (RX), GPIO1 (TX) and GPIO15 (D8) when I was using all the Digital I/O pins (a test I was doing to check out my LoLin NodeMCU board. I found that I had to lift (take out) the jumper to GPIO3 (RX) and GPIO15 (D8) in order to be able to download compiled programs from my PC to the NodeMCU. Once downloaded, I could plug GPIO15 (D8) and GPIO3 (RX) and the sketch would be working. I did notice that if I reset the board, I would also have to lift these 2 pins in order to get it to boot up. Now, I can understand why using RX might mess up downloads or reboots as it is being used to receive data from the PC, but I'm clueless why D8 would also cause this problem. My circuit (as I recall) used an I2C_1602_LCD display on D1 and D2, an 4x4 matrix keypad (Columns on D0, D3, D8, and TX, Rows on D4, D5, D6 and D7). The best I could do was to use TX in place of RX, and then just lift D8 (GPIO15) whenever I downloaded new code or reset the NodMCU. Again, I'm a newbie to the ESP8266, so I don't know all the answers. What I do know is the ESP8266 is a system on a chip (SoC) design with components like the processor chip bought from another vendor/manufacturer. The processor they use (I don't know the name/number or manufacturer) has 16 GPIO lines, some of which are used internally to interface with other components of the SoC, like flash memory. Because these several lines are used internally within the ESP8266 SoC, in the ESP8266 literature they talk only about 11 GPIO pins, 2 of which are generally reserved for RX and TX in order to communicate with a host PC from which compiled object code is downloaded. This leaves just nine real general purpose I/O pins, but a few of these have secondary functions assigned to them and are supported in software by Arduino libraries like the SPI and WIRE libraries. SPI uses 4 GPIO lines (called SCLK, MISO, MOSI and SS (aka CS)) and I2C uses two GPIO lines (called SDA and SCL). So, that just leaves 3 unassigned GPIO lines (pins). Again, the ESP8266 was designed more of as a WiFi server or WiFi Client, not as a Arduino Mega2560, so the number of GPIO pins was not among their primary concerns. If you need a WiFi board with more I/O capability, you might check out the Arduino MKR1000 board which as I recall has a few more pins available. To live with what we got, I can offer a few suggestions. You can use "port expander" chips which are essentially serial-to-parallel shift registers with latched outputs (classic example: 74HC595). The use of shift registers to expand your number of I/O ports can be problematic, especially if you are relying on someone else's library of code to run it. Another option is making some or all of the devices you want to interface SPI or I2C bus compatible. I2C seems to be the most efficient option in terms of pins used. There are just 2, SDA (data) & SCL (clock). Many chip manufacturers use I2C (or SPI) to make their components interface to MCUs more easily, but they also require software to support them. So, having good software development skills is essential to get at the full potential of these devices. Now if you look around the edges of the LoLin NodeMCU, you will see on the others side (opposite the side with the pins marked D0-D8, RX and TX, you will see a bunch of other pins. Some of these are power, ground and system related pins (EN, RST). We know A0 is the single on board ADC (Analog Input). "VU" is the +5V output from the board that comes from the PC via the USB cable (and Vin is where you can plug in a regulated +5V power supply to externally power the NodeMCU without having to use the USB cable.) Then we have S3, S2, S1, SC, S0 and SK. What are these pins used for? I don't really know. In previous versions of the NodeMCU (made by other manufacturers), most if not all these pins were labeled "Unassigned" as I recall from my random readings about the ESP8266 on the Internet. On more recent pinout diagrams of the NodeMCU and on the silkscreen artwork on the LoLin NodeMCU r3, these pins have been assigned some functionality. So far I have not found an article that describes their use (Can anyone else pipe-in on this?). If you accept the latest pinout diagrams (on GitHub as I recall), then the assigned functions seem to be:
And what's the difference between SCLK, MOSI, MISO, CS and HSCLK, HMOSI, HMISO, HCS?
It appears that maybe of the latest releases of the ESP8266 maybe they have stream-lined the internal connections and freed up 2 GPIO pins (my best guess). Have yet to test these.
The above questions & comments refer to the pin-out diagram for the NodeMCU. My testing of the ESP8266 has been sidelined until I figure out several means by which I can interface 3.3V components (MCUs) to 5V components (TTL). I am in the process of testing and documenting three methods by which 3.3V and 5.0V can be interfaced: "Two Resistor Voltage Divider", "The 3 Diodes in Series Method", and my favorite, the "FET Bi-Directional Level Shifter" (using BSS138 FETs). I am also experimenting with lowering the source voltage on 7400 Series HC Family chips like the 74HC04 hex inverter and maybe the 74HC595 shift resister. I'll see if I can spend more time testing these 6 mysterious pins on the NodeMCU. -WRM |
==> randmor |
Dear all, I'm a beginner on nodemcu. I buyed a Wemos/Lolin v3 version and I'm testing with the arduino IDE examples. Can be a dummy question, but I tryied with all configurations that I found on the google to turn on the onboard led! On the Schematic diagram I found "S1 Key". I don't see nothing more about this key. I wil thank a lot any help |
you tried this example? int ledState = LOW; unsigned long previousMillis = 0; void setup() { void loop() |
If my recollection is right, the on-board LED is not on the D0 pin, but rather the Tx (aka TxD0) pin. If you orient the LoLin NodeMCU board such that the WiFi antenna is up, you'll be able to read the pin labels. On the right you will see the data pins labled D0, D1, D2, etc. Follow that down till you see TX (maybe Tx or TxD0, I forget) and that should be the pin that is tied to the onboard LED. Since this is active anytime you send data to the Serial console, I don't use it the same as D13 (digital I/O pin 13) on the Arduino Uno. It's nothing to add a separate LED and current limiting resistor between another digital i/o pin and GND and program it to blink in the manor of the Arduino Uno BLINK demo sketch.I haven't use the LoLin NodeMCU for aboout 6 weeks as I have just moved from China to the States and have not unpacked them, my focus on other things more important in settling into my new digs.
Dear all, I'm a beginner on nodemcu. I buyed a Wemos/Lolin v3 version and I'm testing with the arduino IDE examples. Can be a dummy question, but I tryied with all configurations that I found on the google to turn on the onboard led! |
Being not 100% sure of my previous response, I unpacked my Arduino & ESP8266 stuff and tried out the Blink Sketch on the LoLin NodeMCU board. It does appear from the demo Blink sketch that "LED_BUILTIN" refers to D0 because when I run the Blink sketch it will blink a LED connected to D0. However, the little blue LED on the NodeMCU board does not blink. However, after testings a few of the other digital I/O lines, I found that D4 (GPIO 2) does correspond to the the little blue on-board LED, and the relations ship is inverted compared to the external LED I had attached to D4 via a current limiting resistor. So, if you want to modify the demo Blink sketch to work on the LoLin NodeMCU board so that the blue on-board LED will blink, change the 3 occurrences of "LED_BUILTIN" to "2" (the GPIO number for the D4 port), save and recompile. When you download it, the blue LED should blink. In my sketch, as I usually do, I use the pre-processor #define command to define "Arduino friendly" names to the GPIO pins using the following block of code, and when I use this code, instead of "2" I substitute in "D4" in place of the the 3 occurrences of "LED_BUILTIN". Here's the full "corrected" sketch.../_ ESP8266 Blink by Simon Peter Blink the blue LED on the ESP-01 module This example code is in the public domain The blue LED on the ESP-01 module is connected to GPIO1 (which is also the TXD pin; so we cannot use Serial.print() at the same time) Note that this sketch uses LED_BUILTIN to find the pin with the internal LED_/#define D0 16#define D1 5 // I2C Bus SCL (clock)#define D2 4 // I2C Bus SDA (data)#define D3 0#define D4 2 // Also blinks on-board blue LED, but with inverted logic#define D5 14 // SPI Bus SCK (clock)#define D6 12 // SPI Bus MISO #define D7 13 // SPI Bus MOSI#define D8 15 // SPI Bus SS (CS)#define D9 3 // RX0 (Serial console)#define D10 1 // TX0 (Serial console) void setup() { pinMode(D4, OUTPUT); // Initialize the LED_BUILTIN pin as an output} // the loop function runs over and over again forevervoid loop() { digitalWrite(D4, LOW); // Turn the LED on (Note that LOW is the voltage level // but actually the LED is on; this is because // it is active low on the ESP-01) delay(1000); // Wait for a second digitalWrite(D4, HIGH); // Turn the LED off by making the voltage HIGH delay(2000); // Wait for two seconds (to demonstrate the active low LED)}I suppose an easier way to fix the problem would be to re-define "LED_BUILTIN" as "2" by addingthis following line at the top end of the sketch: I also tested my (erroneous) idea that the blue LED is set to the Tx (TX or TxD0) line which should cause the blue LED when sending data to the Serial console. I modified the Blink sketch my adding 'Serial.begin(9600);' to the setup() function and I replaced all the code in the loop() function with 'Serial.println("This is a test... ");'. I was expecting it to also make the blue LED light up, but it does not, so I was was wrong with my initial response to this email thread. Sorry about that. Perhaps it's the RX line it's attached to (otherwise why does the blue LED blink when you upload sketches to the NodeMCU board... that must be it).
If my recollection is right, the on-board LED is not on the D0 pin, but rather the Tx (aka TxD0) pin. If you orient the LoLin NodeMCU board such that the WiFi antenna is up, you'll be able to read the pin labels. On the right you will see the data pins labled D0, D1, D2, etc. Follow that down till you see TX (maybe Tx or TxD0, I forget) and that should be the pin that is tied to the onboard LED. Since this is active anytime you send data to the Serial console, I don't use it the same as D13 (digital I/O pin 13) on the Arduino Uno. It's nothing to add a separate LED and current limiting resistor between another digital i/o pin and GND and program it to blink in the manor of the Arduino Uno BLINK demo sketch.I haven't use the LoLin NodeMCU for aboout 6 weeks as I have just moved from China to the States and have not unpacked them, my focus on other things more important in settling into my new digs.
Dear all, I'm a beginner on nodemcu. I buyed a Wemos/Lolin v3 version and I'm testing with the arduino IDE examples. Can be a dummy question, but I tryied with all configurations that I found on the google to turn on the onboard led! |
randmor, you are completly right. The output is gpio 2 (D4) inverted logic. Thanks for the explanation! |
Hello friends I'm new to developing with esp8266, I'm trying to connect both an RFID reader rc522 and screen nextion 2.4 "in a NodeMCU 1.0, using arduino IDE v 1.6.11 to read an RFID tag and display the UID in Nextion 2.4 screen ". I managed to connect and work with each separately, but I can not make them work together. when the connections operate separately in NodeMCU v 1.0 are the following: Nextion 2.4 "||| MCU Node 1.0 5V-------------- 5V RC522 ||| MCU Node 1.0 3.3V------ 3.3V Both devices need to use the pin D7 (RXD2), I would like to use both at the same time, I read that I use UART but do not understand how to apply. any help is welcome |
Can anyone tell me where to find the library and files that DEFINE |
Hi!, thanks for the support to this issue I try this code and not works for me, ¿any idea? `#define LED_BUILTIN D4 void setup() { // the loop function runs over and over again forever |
Hi Carlos,
I reviewed the code and it looks correct if you are using a NodeMCU board likethose manufactured or distributed by Amica, DoIt or Lolin. There are likely a few other manufacturers who follow this pin numbering scheme like WeMos on the D1/R2 board. My suspicion is that the board you are using map the "logical" pin names/numbers (as labeled on the board) to different GPIO pin numbers. You should consult any documentation you have on your particular board (perhaps you can "google-it" on the Internet). Or, you can sit down andset up 9 LEDs with current limiting resistors (anything from 220 ohm to 1K ohm),and by testing the pins one by one (and taking notes) you can find out which GPIO pin corresponds to which board pin. In the script below, you can changethe value of "testPin" to one of the values included in the comment below.Hope this helps.
/*#define LED_BUILTIN D4
#define D0 16#define D1 5 // I2C Bus SCL (clock)#define D2 4 // I2C Bus SDA (data)#define D3 0#define D4 2 // Same as "LED_BUILTIN", uses inverted logic#define D5 14 // SPI Bus SCK (clock)#define D6 12 // SPI Bus MISO#define D7 13 // SPI Bus MOSI#define D8 15 // SPI Bus SS (CS)#define D9 3 // RX0 (Serial console)#define D10 1 // TX0 (Serial console)
// Above pin mappings suggest you are using a NodeMCU Board? If not// then it's likely that the board you are using uses a different pin numbering// scheme. */
testPin = 16; // Usable GPIO pins: 0, 2, 4, 5, 12, 13, 14, 15 & 16 // Do NOT use GPIO pins 6, 7, 8, 9, 10, or 11 as these are used by the
// ESP8266 processor to address on-chip flash memory. Use of these
// six forbidden pins will likely crash the ESP8266.
void setup() { pinMode(testPin, OUTPUT); // Initialize the LED_BUILTIN pin as an output} void loop(){ digitalWrite(testPin, LOW); // Turn the LED on (Note that LOW is the voltage level // but actually the LED is on; this is because // it is active low on the ESP-01) delay(1000); // Wait for a second digitalWrite(testPin, HIGH); // Turn the LED off by making the voltage HIGH delay(2000); // Wait for two seconds (to demonstrate the active low LED)}
On Wednesday, June 7, 2017 6:16 AM, Carlos Rojas <notifications@github.com> wrote:
Hi!, thanks for the support to this issueI try this code and not works for me, ¿any idea?`#define LED_BUILTIN D4
#define D0 16
#define D1 5 // I2C Bus SCL (clock)
#define D2 4 // I2C Bus SDA (data)
#define D3 0
#define D4 2 // Same as "LED_BUILTIN", but inverted logic
#define D5 14 // SPI Bus SCK (clock)
#define D6 12 // SPI Bus MISO
#define D7 13 // SPI Bus MOSI
#define D8 15 // SPI Bus SS (CS)
#define D9 3 // RX0 (Serial console)
#define D10 1 // TX0 (Serial console)void setup() {
pinMode(D4, OUTPUT); // Initialize the LED_BUILTIN pin as an output
}// the loop function runs over and over again forever
void loop(){
digitalWrite(D4, LOW); // Turn the LED on (Note that LOW is the voltage level
// but actually the LED is on; this is because
// it is active low on the ESP-01)
delay(1000); // Wait for a second
digitalWrite(D4, HIGH); // Turn the LED off by making the voltage HIGH
delay(2000); // Wait for two seconds (to demonstrate the active low LED)
}`—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I think your code above is on the right track. |
@drmpf I don't have a multimeter =/ |
Try using a LED and Current limiting resistor. Just make sure you have the
polarity of the LED correct...
…On 8 Jun 2017 00:30, "Carlos Rojas" ***@***.***> wrote:
@drmpf <https://github.com/drmpf> I don't have a multimeter =/
I think that I try to find other ways for this problem
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#584 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALP8xWk5zAKMz37QaHsH_a9b47_2Q7q8ks5sByRpgaJpZM4Fdj1r>
.
|
It sounds like it could be one of two NodeMCU boards: a DoIT brand NodeMCU v1.0 or a LoLin Brand. The LoLin NodeMUC board is wider than the "standard" Amica or DoIT brand NodeMCU boards. The LoLin NodeMCU board is the same width as the early v0.9 Amica brand NodeNCU boards which were considered "breadboard" unfriendly because when you plugged one into a standard MB-102 breadboard, all the pinholes were covered, Of course, the solution to that problem is to use a "mini" breadboard along with the MB-102 breadboard and have the LoLin node MCU board straddle the power rails, If you need further details on using a second breadboard, let me know.
The good thing about the NodeMCU boards are the pinouts are mostly compatible, especially with regard to the digital I/O pins.The mappings in the program should work.
#define D0 16#define D1 5 // I2C Bus SCL (clock)#define D2 4 // I2C Bus SDA (data)#define D3 0#define D4 2 // Same as "LED_BUILTIN", uses inverted logic#define D5 14 // SPI Bus SCK (clock)#define D6 12 // SPI Bus MISO#define D7 13 // SPI Bus MOSI#define D8 15 // SPI Bus SS (CS)#define D9 3 // RX0 (Serial console)#define D10 1 // TX0 (Serial console)
In reading other peopl's responses, there may still be a open question as to how your LEDs are being oriented. LEDslike all diodes will let current flow in one direction, so look at the two wire leads on the LED. The longer one should go to the high side of the circuit and the short wire lead should go to the low side of the circuit. A current limiting resistor (220 ohms to 1K ohms) should be wired in series with the LED. It can be placed on either side of the LEDand it has no polarity, so it will work either way you plug it in. By habit, I generally place the LED between the shortwire lead of the LED and ground. The high side of the LED then is typically wired to a digital I/O pin of the NodeMCU board, like D2. You can test to verify the circuit is working by taking the jumper wire from D2 and plugging it intoeither +5V or +3.3V, either should cause the LED to light up. If not, try flipping the LED around in the circuit. If that does not work, try another LED.
If the NodeMCU board you are using still is not working for you, and you have another one on hand, try swapping NodeMCU boards.I can't think what else it could be,
On Wednesday, June 7, 2017 3:46 PM, duncan-a <notifications@github.com> wrote:
Try using a LED and Current limiting resistor. Just make sure you have the
polarity of the LED correct...
On 8 Jun 2017 00:30, "Carlos Rojas" ***@***.***> wrote:
@drmpf <https://github.com/drmpf> I don't have a multimeter =/
I think that I try to find other ways for this problem
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#584 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALP8xWk5zAKMz37QaHsH_a9b47_2Q7q8ks5sByRpgaJpZM4Fdj1r>
.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
hi.
|
I don't have a D1, but I do have a a bunch of D1 minis. I think they're the
same pin, they're just duplicated on the headers for convenience and
compatibility, so that you can use different shields.
…On Jul 23, 2017 8:30 AM, "jimsy3" ***@***.***> wrote:
hi.
this is really confusing somehow....
1.
Wemos D1 has like two D5 pins, and when the SCK pin is called
GPIO14(on the IOH jumper), then what is the other D5 pin called that is on
the IOL jumper(together with Tx and Rx etc)?
https://wiki.wemos.cc/_media/products:d1:d1_v2.0.0.pdf
2.
and if they are called the same(GPIO14), then how does the software
know where to read the input data?
3.
i guess the IOL14 is the same as Pin7 on Arduino Uno and IOL16 aka D0
is the same as Uno's Pin2? so, would i be better of to use D0 instead of D5
then? (as i need to declare the pin number in IDE software)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#584 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQC6Bok9L8D4PBnrxlSHddTGRE-F71MVks5sQzzXgaJpZM4Fdj1r>
.
|
Hello, First of all thanks for all your work, without that I could not do this small project on university. #include <Stepper.h> int in1Pin = 12; // change this to the number of steps on your motor Stepper motor(STEPS, in1Pin, in2Pin, in3Pin, in4Pin); void setup() // this line is for Leonardo's, it delays the serial interface Serial.begin(9600); void loop() This code is for arduino boar |
There are D0...Di #defines available for most boards. Just assign directly
to your pins:
int pin1 = D0;
...
…On Aug 11, 2017 1:21 PM, "Ashish05178" ***@***.***> wrote:
Hello,
First of all thanks for all your work, without that I could not do this
small project on university.
I have a newbie question, but first I show you my small code:
#include <Stepper.h>
int in1Pin = 12;
int in2Pin = 11;
int in3Pin = 10;
int in4Pin = 9;
// change this to the number of steps on your motor
#define STEPS 512
Stepper motor(STEPS, in1Pin, in2Pin, in3Pin, in4Pin);
void setup()
{
pinMode(in1Pin, OUTPUT);
pinMode(in2Pin, OUTPUT);
pinMode(in3Pin, OUTPUT);
pinMode(in4Pin, OUTPUT);
// this line is for Leonardo's, it delays the serial interface
// until the terminal window is opened
while (!Serial);
Serial.begin(9600);
motor.setSpeed(100);
}
void loop()
{
if (Serial.available())
{
int steps = Serial.parseInt();
motor.step(steps);
}
}
This code is for arduino boar
Based on a code made available on http://www.circuitmagic.com
can anyone please tell what changes I have to do in this code for
nodemcu---For pin D0,D1,D2,D3
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#584 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQC6BrC1xoryP8lFQxwkf2b4syQm31qsks5sXI2TgaJpZM4Fdj1r>
.
|
These types of error coming in COM5 after uploading program |
I see on some pinouts, they show the SDD2 and SDD3 also labelled as gpio9 and gpio10. If you weren't using anything that required the additional SDD pins, can you map these as additional digital pins? (i.e. as D11 and D12?) I also see no standard per se for I2C although there does appear to be for SPI. The closest I see is a couple examples of people using D1 (GPIO5) for SCL and D2 (GPIO4) for SDA pins. I'm assuming they grab these two because they aren't really tasked for anything else as many of the others are. Are these the best two to use for I2C? |
i don't know what i am doing wrong but somehow i cant get the voltage of D0 (pin16) LOW while LED_BUILTIN ist HIGH. My Problem is, that most of the time the board does nothing. Its just connected to WiFi and waits for commands. I do not want the blue LED to glow all the time. But if i turn it off with digitalWrite(LED_BUILTIN, HIGH) D0 also turns HIGH. |
@jimboD not the right place to seek help. |
Ahh, I see. Thank you. But what do you mean "not the right place to seek help"? You helped me. |
@jimboD The fact that you are able to park on a crosswalk does not make a crosswalk the right place to park :-) |
Thank you very much.
…On Tue, Apr 3, 2018 at 12:57 PM vdeconinck ***@***.***> wrote:
@jimboD <https://github.com/jimboD> The fact that you are able to park on
a crosswalk does not make a crosswalk the right place to park :-)
Indeed devbyte was kind enough to give you insightful hints, but it's not
the right place because (a) this is an issue tracker for bugs found in the
Arduino core dor ESP8266 (b) you are hijacking a 3-year old discussion and
(c) this issue is closed.
Questions and help requests about esp8266 cores or esp8266 in general
should be directed to forums such as esp8266.com or stackoverflow.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#584 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AkENywmQ7D3X6mR-tl9ef3XoM3AsX9ROks5tk9Q7gaJpZM4Fdj1r>
.
|
Error compiling for board NodeMCU 1.0 (ESP-12E Module). |
please help me to solve this error |
#define trigpin D0 void setup() } void loop() duration = pulseIn(echopin, HIGH); dist = (duration*0.343)/2; distance = dist / 100.0; delay(2000); } Hello everyone, |
What board (ESP) have you selected in the IDE ?
…On Thu, Aug 22, 2019 at 3:17 AM anitakenchannavar ***@***.***> wrote:
#define trigpin D0
#define echopin D1
long duration, dist;
float distance;
int action;
void setup()
{
pinMode(trigpin, OUTPUT); // D0 - TrigPin
pinMode(echopin, INPUT); // D1 - EchoPin
Serial.begin(9600);
}
void loop()
{
digitalWrite(trigpin, LOW);
delayMicroseconds(2);
digitalWrite(trigpin, HIGH);
delayMicroseconds(10);
digitalWrite(trigpin, LOW);
duration = pulseIn(echopin, HIGH);
dist = (duration*0.343)/2;
distance = dist / 100.0;
Serial.println(distance);
delay(2000);
}
Hello everyone,
I am a newbie working on IOT projects. This is my code which I am
interfacing with NodeMcu Amica Board. I am not sure of the pin numbers. In
the above code I am getting an error saying D0 not defined in this scope.
How to understand the pin numbers.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#584?email_source=notifications&email_token=AAHQ44URFIVS6GNJWC66SKLQFYVQFA5CNFSM4BLWHVV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD44AJDA#issuecomment-523764876>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAHQ44Q2XANKYCWZQWIETSDQFYVQFANCNFSM4BLWHVVQ>
.
--
Desiree Santos
*Thought*Works
|
Another option is to use the pin numbers instead of constant. (Reference
here <#584 (comment)>)
static const uint8_t D0 = 16; static const uint8_t D1 = 5;
static const uint8_t D2 = 4;
static const uint8_t D3 = 0;
static const uint8_t D4 = 2;
static const uint8_t D5 = 14;
static const uint8_t D6 = 12;
static const uint8_t D7 = 13;
static const uint8_t D8 = 15;
static const uint8_t RX = 3;
static const uint8_t TX = 1;
On Thu, Aug 22, 2019 at 9:43 AM Desiree Santos <dsantos@thoughtworks.com>
wrote:
… What board (ESP) have you selected in the IDE ?
On Thu, Aug 22, 2019 at 3:17 AM anitakenchannavar <
***@***.***> wrote:
> #define trigpin D0
> #define echopin D1
> long duration, dist;
> float distance;
> int action;
>
> void setup()
> {
> pinMode(trigpin, OUTPUT); // D0 - TrigPin
> pinMode(echopin, INPUT); // D1 - EchoPin
> Serial.begin(9600);
>
> }
>
> void loop()
> {
> digitalWrite(trigpin, LOW);
> delayMicroseconds(2);
> digitalWrite(trigpin, HIGH);
> delayMicroseconds(10);
> digitalWrite(trigpin, LOW);
>
> duration = pulseIn(echopin, HIGH);
>
> dist = (duration*0.343)/2;
>
> distance = dist / 100.0;
> Serial.println(distance);
>
> delay(2000);
>
> }
>
> Hello everyone,
> I am a newbie working on IOT projects. This is my code which I am
> interfacing with NodeMcu Amica Board. I am not sure of the pin numbers. In
> the above code I am getting an error saying D0 not defined in this scope.
> How to understand the pin numbers.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#584?email_source=notifications&email_token=AAHQ44URFIVS6GNJWC66SKLQFYVQFA5CNFSM4BLWHVV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD44AJDA#issuecomment-523764876>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAHQ44Q2XANKYCWZQWIETSDQFYVQFANCNFSM4BLWHVVQ>
> .
>
--
Desiree Santos
*Thought*Works
--
Desiree Santos
*Thought*Works
|
For NodeMCU users: Select NodeMCU 1.0 (ESP-12E Module), not Generic ESP8622 Module in the Arduino IDE. Even if you are using a NodeMCU V2. After doing so the pin mappings (e.g. for the digital pins) printed on the board can be used without defining them manually. The following will work:
|
Agree completely @tim Pulver !!
It's a typical error message around setup board
…On Fri, Aug 23, 2019 at 5:09 PM Tim Pulver ***@***.***> wrote:
For *NodeMCU* users:
Select *NodeMCU 1.0 (ESP-12E Module)*, *not* Generic ESP8622 Module. Even
if you are using a NodeMCU V2. After doing so the pin mappings (e.g. for
the digital pins) printed on the board can be used without defining them
manually.
The following will work:
digitalWrite(D0, HIGH);
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#584?email_source=notifications&email_token=AAHQ44VEME5XGXJNMZW2Z2LQGA7W7A5CNFSM4BLWHVV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5BGQQQ#issuecomment-524445762>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAHQ44RLHQIK33YAJ7HYDR3QGA7W7ANCNFSM4BLWHVVQ>
.
--
Desiree Santos
*Thought*Works
|
backported esp8266#584 screensaver
thanks alot bro..worked |
Hi,
First off I want to thankyou for incorporating the ESP into the Arduino IDE!
I have a www.doit.am esp12e devkit module with the motor shield board.
it programs fine with the Arduino IDE. Board esp12e, 80mhz etc
So I tested it with the blink sketch and if I said blink pin 0 it would blink pin 3 on the board/chip.
So here is the other pins.
pin0 = pin3
pin1 = flashing led on the nodemcu
pin2 = pin4
pin3 = nothing
pin4 = pin2
pin5 = pin1
pin6 = nothing
pin7 = nothing
pin8 = nothing
Any ideas?
Do I need a different firmware. I have version 0.95_20150318
Cheers
The text was updated successfully, but these errors were encountered: