Best Of
Re: HC-SR501 PIR
Hello @barriereg,
Can you test the PIR sensor with the code I added below. You need to make the PIR sensor connections as follows.
VCC-VBUS, GND-GND, OUT-GP14
Please test the PIR sensor directly without connecting the gas sensor.
Thanks.
Naze
Re: WiFi module (ESP8266) - what Library(s) are needed?
@MSMorkan thanks for that answer - worked perfectly!
How to ask a question in the MicroBlocks category
To improve the chance of getting help on the community please follow these recommendations when posting a question:
- You searched the community for similar topics/issues.
- You searched the wiki (https://wiki.microblocks.fun/) for information on your question/issue.
- Please, do not open multiple threads on the same topic.
- Choose a meaningful topic title (not something like this: "I have a problem" or "Please help").
- Give a precise (detailed) description of
- the issue/bug,
- the goal.
- Show the (relevant) blocks (images, screenshots of blocks in high quality).
For instance: Right-click on the grey part of the block editor and choose to save a picture of all scripts.
If you only want to share some of the blocks, right-click on the blocks you want to share and choose save picture of script.
- Tell us about the MicroBlocks version running on your computer and the firmware version on your picobricks.
Click on the gear icon and click about... It will show you a dialog like the one below.
- Tell us about the operating system you are using. For instance Linux Mint 21, macOS Ventura, Windows 11, etc.
- Take a look on the MicroBlocks website to see if the latest Pilot version already fixes your "problem¨.
- Attach your ubp-file if that helps explain your issue. Remember, this is not a replacement for adding images.
- Write in English if possible.
- Use English blocks (set the language in MicroBlocks - temporarily - to English).
Click on the globe icon and choose English
Re: How to ask a question in the MicroBlocks category
Thank you so much for your support. :)
Loading MicroBlocks Projects from Robotistan GITHUB repository
Since we are revising the PicoBricks eBook, everyone's best bet for the latest versions of the projects is the GITHUB repository athttps://github.com/Robotistan/PicoBricks/tree/main/Software/Activities.
Instructions below are meant for a person getting ready to work on a specific project. It will basically start you from a clean slate and get you working on the project. If you previously have worked on one of these projects and then you do what is described here, your current project you were working on may be affected, unless you have saved it somewhere on your PC beforehand. Just be careful!
Once you select an Activity and click on it, you will be at a page with multiple program selections, one of them being MicroBlocks. Here I am using the BLINK project as an example.
Now, when you select the MicroBlocks entry, you will be taken to a page with the MicroBlocks version of the project files. There will be an image of the blocks and some text with loading tip.
You will see two different ways you can load your project into MicroBlocks IDE:
- Using an Image Link
- Using an URL Link
Image Link works by letting you drag and drop the image shown onto the Scripting Area of the MicroBlocks IDE. This assumes you have a Browser tab with the MicroBlocks loaded and selected File / New to start off clean.
URL Link works by automatically executing a copy of MicroBlocks in the Browser and then loading the selected project into it. The end result will the same.
Just one caution about URL Link method: it will open up a NEW browser window with the MicroBlocks and your project loaded, every time you click the link. If you keep doing it for different projects or for even for the same project, you'll end up with as many MicroBlocks Sessions running. Then you will start complaining why your computer is so slow! So remember to close the previous sessions if you are going to use this method.
NOTE: I know there will be those who are going to ponder how dragging an image allows one to load a program into an IDE. For that you need to research info on PNG image format and their various header types.
TLDR: We embed the project code into the PNG image and then extract it in the IDE.
Now, go ahead and create something!
Re: WiFi module (ESP8266) - what Library(s) are needed?
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.
Re: WiFi module (ESP8266) - what Library(s) are needed?
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.
Re: Is there a Real Time Clock in PicoBricks?
You can check the specs for the PICO2040 chip (https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf) for memory limits.
If you are playing in the Arduino / Python IDE environment with compilers etc, you will go by those limits.
However, remember that while in MicroBlocks, those do not mean much, as the MB VM (virtual machine), user programs, libraries, variables, user functions all need to use a slice of the big pie. So there are other limits imposed by the MicroBlocks to make sure everything runs real-time with all the events firing on time, and still allow the users to modify the running code.
There are a few holy numbers:
Individual script size: 1000 bytes; Strings: about 800 bytes; Numbers: 32 bit limit (actually 30 bits); IO buffers: change depending on method used, but still bracketed by the 1000 byte limit.
@PeterMathijssen s memory numbers are related to runtime memory for the user programs and their data structure needs, but is not indicative of the numbers I have provided. VM needs its space as well, and will complain when things are not quite sufficient, which is very dependent on what processor board you are running on. The style of code you write impacts the memory use and dynamics a lot. For small programs, nothing really matters much. But as you get into bigger tasks, you will have to abide by the limits and use the proper techniques, or things will simply not be the way you want it.
When one is working in microsecond resolution event driven environment all in blocks, one tends to forget that it is not the same as the compiler optimized code running in other IDEs.
Back behind the chips and circuits, it is a wild wild world! And we love it, of course!
Re: E-Book inaccuracies
@Turgut So sorry - I am totally new to your community website, PicoBricks etc. I did not see any mention of Custom Blocks until your post just now. Perhaps I missed an email notification - again, sorry for the inconvenience... I have spent a good deal of my time finding these errors for you...
Re: E-Book inaccuracies
Nothing to be sorry about! All is good.
We are all newbie's at one thing or another, and let's grow together.
Your error corrections are much appreciated and I am revising the instructions / description for the Example Projects. Soon there will be hopefully a better version out.