Skip to content
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

Patch 1 #2461

Closed
wants to merge 11 commits into from
Closed

Patch 1 #2461

wants to merge 11 commits into from

Conversation

timg11
Copy link
Contributor

@timg11 timg11 commented Aug 17, 2018

This is only a suggested page to improve the documentation.

devsaurus and others added 11 commits May 21, 2017 09:38
2.1.0-follow-up master drop
As per hmc5883l datasheet 2nd and 3rd bytes are of z axis rather than y.
…cu#2205)

* host field in HTTP header is no longer limited to 31 charcters
* added description for magic values
For NodeMCU newcomers referring to Lua documentation, this is an placeholder to explain how to work around the missing io module.  I spent hours trying to figure this out.
@TerryE
Copy link
Collaborator

TerryE commented Aug 18, 2018

Leaving aside you've some done this PR of an old dev so it's messed up, I really think that you should raise this as an issue and we should address this in the FAQ as specific point on io and file.

If you came here looking for the Lua io module that doesn't exist in NodeMCU, read on.

The only mention of the io module in NodeMCU is in the NodeMCU Developer FAQ, where it says
"For example, the standard io and os libraries don't work, but have been largely replaced by the NodeMCU node and file libraries."

Unfortunately, if you are new to NodeMCU and Lua, there is little to go on to understand how to proceed. If you have read the Lua documentation on The Simple I/O Model, you might be looking for io.write as a way to output text similar to print() but with more control. With NodeMCU, the file library is suggested as a replacement, but it will not write to stdout like io.write. file.write(string) will not work because there is no file open.

It is not clear how to proceed without the io module. There is nothing analagous to stdout to open. The solution is to use the uart module. The Lua example io.write("hello", "Lua") would be written uart.write(0,"hello", "Lua")

Note that the UART ID value of 0 has to be added. UART 0 is the same one the the print() function uses.

The ESP is an IoT device and does not have a POSIX OS or the like, so the full features offered by a typical OS aren't available. The original authors chose to mirror the then features of the SPIFFS implementation and basic UART drivers. The current developers here had all become familiar with this before they became committers so have never seen the need. Perhaps we should spell this out, but the answer is not a "this module is not here" in dummy io and os slots in the modules section but as as a more expanded point in the FAQ.

@marcelstoer
Copy link
Member

@timg11 I have to agree with Terry here. I think you raised a valid point and kudos for offering this as PR. Unfortunately we can't accept it as-is due to the issues Terry mentioned.

-> I created #2462

@timg11
Copy link
Contributor Author

timg11 commented Aug 18, 2018

As a newcomer to NodeMCU and Lua, I found the existing FAQ (although well written) did not point me in the right direction to find my solution. The statement "The current developers here had all become familiar with this," while undoubtedly true, is still not helpful to a newcomer. If you would like to use any of my text to edit the FAQ, please do so. I can also make an attempt of another PR on the FAQ directly if you would consider it.

@TerryE
Copy link
Collaborator

TerryE commented Aug 18, 2018

@timg11, you've picked up one one great weakness of the FAQ, which is that it is aimed at developers new to NodeMCU but was written by a guru in it so sometimes it doesn't contain questions that need asking an answering.

Unlike most new developers, you have also made the effort to give constructive feedback. Can I suggest that you pick this dialogue up on #2462 ? But rather than attempting PRs at this stage, what would be of tremendous value to us and ultimately to fellow new joiners would be for you just to read through the FAQ and make notes on what Qs are missing and perhaps are not addressed in the text. Report this back on the issue and we can discuss and refine this content there. 😃

@marcelstoer
Copy link
Member

#2462 is one specific topic in the broader context of #2332.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants