WiFi module (ESP8266) - what Library(s) are needed?
In the Projects e-book I saw Sample 25 that used some code blocks that start with "ESP01_", which I'm pretty sure relate to the WiFi module (ESP8266). Where do we find the library that adds these code blocks? I do see a WiFi library (under Libraries->WiFi), but once added there are no ESP01_ code blocks...
Suggestion: use Comment blocks in Samples that use WiFi to inform users what the prerequisites are, where to find required library(s) etc...
Project #25 Custom Blocks menu has all the ESP01 functionality for the project provided.
- Corrected to My Blocks menu.
I don't see the phrase "Custom Block" (or Custom Blocks) anywhere in the e-book, other than in the beginning when it talks about the Scripting Area. I just looked at #25 again, and don't really understand where/how Custom Blocks are being defined. I was expecting a Library, just like the OLE display uses. Perhaps you can explain how we access the ESP8266 WiFi module in layman's terms?1
OK, my bad!
It is not Custom Blocks but My Blocks menu. We keep calling it custom blocks in our group and just automatically wrote that. Apologies.
ESP01 interface is basically a Serial Communication link at 115200 baud that uses AT commands to configure and control the unit.
Anything more detailed than that and I will have to refer you to the:
User Guide: https://docs.espressif.com/projects/esp-at/en/release-v126.96.36.199_esp8266/AT_Command_Set/index.html
Technical Reference: https://www.espressif.com/sites/default/files/documentation/esp8266-technical_reference_en.pdf0
Ahhh, I was going to ask if you were referring to My Blocks. So My Blocks is just a way of creating a callable routine that you assign a name to? And I assume you pass one or more parameters to a My Block routine?
Interesting that one uses the good old Hayes modem “AT” command set to access the ESP8266. I did a lot of modem coding back in the 80s and 90s…0
My Blocks is just like to old fashioned "Function Definitions" with or without parameters.
In MicroBlocks functions can be :
- command type (rectangular block shape), where the function executes and does something, changes something etc.
- or reporter type (oval block shape), where they still do their work, but RETURN some value via the return block.
Check out any libraries for these two block types and you'll see it how they work.
RE: good old Hayes modem “AT” command set:
Well, both Bluetooth and and ESP01, as well as plenty other comms devices use this type command structure, since it is easy to communicate over the serial port using text strings. Any other form requires bit-fiddling and it not easy for newcomers to learn that technique while working with blocks. Nevertheless, it is totally possible and used in the OLED library (definitely worth studying).
Since you are comfortable with it, you will have no problem following the code of the ESP01 blocks, specially if you also are familiar with TCP and HTTP exchanges.
Here are some detailed references for MicroBlocks and PicoBricks:
While you are at the WIKI pages, look through some of the other projects we have there. The range is pretty amazing.
Looking at project #25 again: I see a code block (light blue) named ESP01_restore. But I do not see anywhere that this command/function (it is a My Block, right?) is created/defined. I am viewing a PDF of the Projects e-book in my browser. What am I missing?0
RE: What am I missing?
I don't know!0
Based on earlier advice, I saved an empty project that I named "Default Settings (Libraries)" that starts off with the most commonly used libraries already loaded. When I click on My Blocks, all I see in MicroBlocks is two options: [Add a command block] and [Add a reporter block] - see screenshot below.
I assume I need to create all the ESP01_* blocks by going to My Blocks->[Add a command block] (or [Add a reported block]) ? But where do I see the code that goes into those custom My Blocks?0
At the end of Project #25 (like all other projects), there is a link to access the code (see screenshot below). I have been using the PDF version of ebook, not HTML, so the link does nothing. So, I just opened the HTML version of ebook and clicked on the first "access" link - all it did was move back a page or two where some of the MicroBlocks code is shown... Was thinking maybe the link would let me download all the MicroBlock code for this project, but it does not...0
Here is how you load the projects:
Open the GITHUB page - https://github.com/Robotistan/PicoBricks/tree/main/Examples/Activities/Smart%20Greenhouse/smart-greenhouse-microblocks. Should look like:
Then with an EMPTY MicroBlocks project open in the IDE, click on the image in the GITHUB and drag and drop it onto the middle of the MicroBlocks IDE. And you'll have the project loaded.
Once a project is loaded, you can examine any of the My Blocks codes in it by right clicking the specific block and selecting the menu option "show block definition". Below picture shows the option selected for the block.
The block definition code will be displayed at the bottom end of your IDE. Scroll to it.
You need to read the User Guide for the IDE and Block Reference sections of the WIKI if you want to learn how to manipulate the environment. I had sent the links earlier.1
@Turgut up until this point, I had been manually entering all the code blocks shown for each project into the MicroBlocks IDE. Was going to do the same for #25, but saw reference to the ESP01_* code and was lost :) Maybe I missed it, but shouldn't the e-book instruct us to load the code as you've just described - at least for #25? 🤔 I thought I would learn the MicroBlocks better by hand coding, as opposed to just load and play...0
There is nothing wrong with entering everything by hand, but there are other ways hinted at the documentation.
The CLICK links in the PDF, at the end of each project, execute MicroBlocks in the browser and load the respective code into it.
In the mean time, we started the GITHUB convention for a more controlled and up-to-date experience. Specifically with project#25, we experienced some problems and had to make some changes. So the links for that one were blocked for a while. From GITHUB, one can use the project image drag and drop onto the IDE.
But many users prefer a book format to GITHUB. However, PDF is a bit outdated all the time, as we make rapid changes based on user feedback and other reasons. So the latest and greatest is still going to be in GITHUB, with the PDF update coming in next. I am revising the entire eBook PDF for all these reasons, and will have a new version in two weeks. I will make sure to include a section on loading programs, specifically.
Aside from all that, we really expect the users to read the minimal documentation and learn to load programs and other operations from our reference documents.
Yet, I totally understand the excitement of getting something new to try and play with and just dive in and start working with it.0
I opened the Github link for #25, saw the code blocks, then dragged image of code blocks to the MicroBlocks window (no code loaded, except for default libraries). But nothing happens after I drag image. I am using an iMac and FireFox for Mac and of course the MicroBlocks app for Mac. Since dragging doesn't seem to work, I next looked at the note "You can access the MicroBlocks codes of the project by dragging the image to the MicroBlocks Run tab or clicking here". I don't see any "tabs" in the MicroBlocks IDE GUI - do I have to turn on some advanced setting to see it? I also tried clicking on the here link - that opened a new tab in FireFox and seems to be stuck in an infinite loop, displaying Downloading... with a spinning progress icon. I waited several minutes...0
Just tried Safari browser on iMac - dragging the image still does nothing. Then I tried clicking on the download link - that worked! It opened what appears to be a 2nd instance of MicroBlocks with all the project #25 code showing. But the Mac's title bar shows this as actually to be a Safari web page "Microblocks.fun". Now I'm really confused :)0
Finally :) I was able to do a File->Save from the web version of MicroBlocks (that the download link initiated/opened). It saved it as Untitled.upb in my Mac's Download folder. Moved (and renamed) that file to my folder where I store all sample projects. Then opened it in the MicroBlocks app and now see all the code! Phew...
I'm writing lots of details in these posts for the next PB novice that has questions :)0
Below is a screenshot of the MB code window after opening the .upb that I downloaded. There's an [ESP01_display_LOG] code block that appears all by itself. Is that correct, or do I need to clean it up?0
"Aside from all that, we really expect the users to read the minimal documentation and learn to load programs and other operations from our reference documents."
Actually, I simply followed the only instructions on the "Start a new adventure here!" sheet that came with my PB kit. It showed a QR code labeled Start Here - which simply points to the e-book for the 25 sample projects. That ebook had a mini tutorial about using MicroBlocks in the beginning of it - which I did read...0
The lonely ESP01_display_LOG blocks is a reporter block that displays the LOG entries recorded as the project executes.
Since during execution, HTTP commands arrive from the cell phone APP or a browser window in case of a testing session, we record the comings and goings in the LOG for inspection later on. If things go wrong, it provides a way to trace what has expired.
If you don't like it, you can delete it. It is always available later via the My Blocks.1
@Turgut I did get WiFi module to work in #25 - thanks for all your help!
I unhid My Blocks->ESP01_requests, then saw its code call _handleIPD (4th block up from bottom). I am confused as to why _handleIPD doesn't show under My Blocks? I was able to right-click on _handleIPD and choose Show Block Definition - which then displayed that custom function in the main code window...0
I am not the one who deleted your comments. As a matter of fact I would prefer to have them on.
Please check with Robotistan Community administrators as to any policies on post content.
If you click to "show advanced blocks" _handleIPD will be there 😊
Have a nice day1
This is John Maloney, leader of the MicroBlocks team.
I'm sorry there have been some hard words exchanged here. I think some background might help.
MicroBlocks is a non-profit, open-source project. It is under the fiscal sponsorship of the Software Freedom Conservancy, a 501(c)(3) non-profit. MicroBlocks is free to anyone who finds it useful.
MicroBlocks is run by a tiny team of volunteers. Turgut and I are both volunteers, and we both work on the project more than full time because we believe in it. We want to help people of all ages have fun while exploring microcontrollers, and we want to inspire the next generation of children to become creative problem solvers. In short, MicroBlocks is a labor of love.
MicroBlocks is collaborating with Robotistan on the PicoBricks project as a way to bring MicroBlocks to a wider audience. MicroBlocks is not being paid for that collaboration.
The PicoBricks ebook was written by two Turkish teachers who were not familiar with MicroBlocks when they started the project. The current draft has some issues, both with the code and the explanations. Turgut has volunteered to edit the book and is working through the 25 project as fast as he can.
Although Robotistan is a for-profit company, they are also passionate about inspiring the next generation of children to become creative problem solvers. They designed PicoBricks to be as affordable as possible and they are working with MicroBlocks to make PicoBricks available at a discount to teachers in Africa, the Middle East, and Central Asia.
This community is united by our common interests in creating cool things with microcontrollers and electronics, learning more, and sharing our interests with young people. While neither MicroBlocks nor PicoBricks is perfect, both are being actively improved by people who really care. Things will improve faster if we work together.1
@John_Maloney while it sounds like MicroBlocks has a commendable mission statement, I found it truly disheartening than Turgut would respond the way he did. I worked with microcontrollers for 20 years, but that was 40 years ago. So I luckily am ahead of most PicoBricks users. And, if I ask a question, more than likely future newbies will too. If Turgut had simply answered the question, he would have likely been providing the answer to others as well. Instead, he took a very callous and arrogant attitude in his reply. This is supposed to be a COMMUNITY website where information gets shared amongst members, whether they are complete newbies or seasoned experts. Hopefully he can return to that Community spirit…0
- 96 All Categories
- 3 Community
- 3 Hello Maker!
- 83 PicoBricks - Make, Run, Split, Merge
- 26 Hardware Support
- 14 PicoBricks Backers Hub
- 41 MicroBlocks Support
- 2 Shipping Support
- 10 Products & Technology
- Raspberry Pi
- 10 Other