Thursday, May 15, 2014

Using miniBloq as an IDE

One of the main features of the new v0.82 version is that it allows to make text coded programs. And not just in C/C++ and Arduino-compatible syntax, but also in Python and, if the community adds more targets, in nearly any imperative/OOP language (such as JavaScript, Java, Ruby, etc.). Although in future versions this will be simpler and I'm improving the user experience as much as I can, right now it's fully functional. And it has a feature which I really like: the possibility of switching between a text and a graphical program at anytime during the development. This way, you can make fast test with the blocks, while programming the core of your application with the full power of C/C++ (or whatever language your hardware is using with miniBloq). Let's see how to create an example text coded "echo" program for an Arduino board:

1. Open miniBloq (we will be using Arduino Mega 2560 for this example, but you can select any other Arduino-compatible board from miniBloq's hardware list):


2. Since we will create the whole code for the project, we don't want to initialize the board automatically. So we will change the first call to initBoard, for a call to the function go():
What does this mean? It means that at the very beginning of your program, it will do nothing but calling the go() function. And what is the go() function? Is a function that you will write by your own, and where your program will start. It's like the main() function in C/C++, but we can not name it main() because that name is already used internally by the Arduino kernel (I will post more about this soon). In  "Arduino terms", the go() function is equivalent to the setup() function.

3. Add a new cpp file (created just as a text file). First, go to the File->Add menu:

save the component (miniBloq's jargon for your program):



And inside the component's folder, create the text file:



We will name it echo.cpp but you can use any (valid) name of your preference:


You will see this message box when you change the file extension from txt to cpp. Of course say Yes:


Now, you will see the echo.cpp open in the file editor in miniBloq:


You can hide the blocks editor to gain space in the screen to work with your text file:


4. Let's add some code there. You will need to include the mbq.h file, which gives you access to the libraries for the motors, the sensors, the Arduino API functions, etc.:


5. If you compile that, it should compile just fine, but it's an empty program. Now, please try the following piece of code, which is our final echo program:

#include <mbq.h>

void go()
{
serial0.begin(115200);

while(true)
{
if (serial0.available())
{
int inByte = serial0.read();
serial0.print((char)inByte);
}
}
}

6. Run it and you will see how it works by using miniBloq's terminal:


Finally, if you want to use blocks to test, you just need to select initBoard() in the Start block, and start adding your blocks there. The files that you have added will remain there (unless you close them). Once you want to return to the text coding, just select go() again in your start block.

In a future post, I want to show you how to work with multiple file projects. But probably you can just try to experiment a bit by yourself using the Add file feature.

Enjoy!

56 comments:

  1. I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.
    data analytics course mumbai

    data science interview questions

    business analytics courses

    data science course in mumbai

    ReplyDelete
  2. I finally found great post here.I will get back here. I just added your blog to my bookmark sites. thanks.Quality posts is the crucial to invite the visitors to visit the web page, that's what this web page is providing.
    ExcelR Data Science course Mumbai
    ExcelR data analytics courses in Mumbai
    data science interview questions
    ExcelR Business Analytics courses in Mumbai

    ReplyDelete
  3. This is a wonderful article, Given so much info in it, Thanks for sharing. CodeGnan offers courses in new technologies and makes sure students understand the flow of work from each and every perspective in a Real-Time environmen python training in vijayawada. , data scince training in vijayawada . , java training in vijayawada. ,

    ReplyDelete
  4. Really awesome blog!!! I finally found great post here.I really enjoyed reading this article. Nice article on data science . Thanks for sharing your innovative ideas to our vision. your writing style is simply awesome with useful information. Very informative, Excellent work! I will get back here.
    Data Science Course
    Data Science Course in Marathahalli

    ReplyDelete
  5. You have clarified the idea truly well. Was searching for this data from some time and fortunately I discovered your post. Searching forward for a greater amount of such useful updates from you
    Data Science Training In Hyderabad
    Data Science Course In Hyderabad

    ReplyDelete
  6. wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries.
    Data science Interview Questions
    Data Science Course

    ReplyDelete
  7. keep up the good work. this is an Ossam post. This is to helpful, i have read here all post. i am impressed. thank you. this is our Data Science course in Mumbai
    data science course in mumbai | https://www.excelr.com/data-science-course-training-in-mumbai

    ReplyDelete
  8. Thanks for the information about call centers. It is always great to read about this ever changing industry.
    Best Data Science training in Mumbai

    Data Science training in Mumbai

    ReplyDelete
  9. wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries. keep it up.
    data analytics course in Bangalore

    ReplyDelete
  10. I am speechless as to how great this article is. The content is simple to understand and very engaging. This is by far some of the best content I've seen.
    SAP training in Kolkata
    Best SAP training in Kolkata
    SAP training institute in Kolkata

    ReplyDelete
  11. There are many things mentioned in this article I would not have thought of on my own. This material is inspirational, interesting and it allows the readers to open up their minds to original thinking.
    SAP training in Mumbai
    Best SAP training in Mumbai
    SAP training institute Mumbai

    ReplyDelete
  12. So far, I agree with you on much of the info you have written here. I will have to think some on it, but overall this is a wonderful article.
    SAP training in Mumbai
    Best SAP training in Mumbai
    SAP training institute Mumbai

    ReplyDelete
  13. This material makes for great reading. It's full of useful information that's interesting,well-presented and easy to understand. I like articles that are well done.


    SEO services in kolkata
    Best SEO services in kolkata
    SEO company in kolkata
    Best SEO company in kolkata
    Top SEO company in kolkata
    Top SEO services in kolkata
    SEO services in India
    SEO copmany in India

    ReplyDelete
  14. Cool stuff you have and you keep overhaul every one of us

    Correlation vs Covariance

    ReplyDelete
  15. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
    Correlation vs Covariance

    ReplyDelete
  16. The context has been explained really well. Looking forward to see more of such informative updates
    Machine Learning Training in Hyderabad

    ReplyDelete
  17. This post is very simple to read and appreciate without leaving any details out. Great work!
    Data Science Certification in Bangalore

    ReplyDelete
  18. Your article is very informative. It's a welcome change from other supposed informational content. Your points are unique and original in my opinion. I agree with many of your points.
    SAP training in Kolkata
    SAP training Kolkata
    Best SAP training in Kolkata
    SAP course in Kolkata
    SAP training institute Kolkata

    ReplyDelete
  19. I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own Blog Engine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.
    Data Science Course in Bangalore

    ReplyDelete
  20. Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained!
    Data Science Training in Bangalore

    ReplyDelete
  21. This comment has been removed by the author.

    ReplyDelete
  22. You are in point of fact a just right webmaster. The website loading speed is amazing. It kind of feels that you're doing any distinctive trick. Moreover, The contents are masterpiece. you have done a fantastic activity on this subject!
    Business Analytics Training in Hyderabad | Business Analytics Course in Hyderabad

    ReplyDelete
  23. I feel really happy to have seen your web page and look forward to so many more entertaining times reading here. Thanks once more for all the details.
    Data Science Training in Hyderabad | Data Science Course in Hyderabad

    ReplyDelete
  24. Very interesting blog. Many blogs I see these days do not really provide anything that attracts others, but believe me the way you interact is literally awesome.You can also check my articles as well.

    Data Science In Banglore With Placements
    Data Science Course In Bangalore
    Data Science Training In Bangalore
    Best Data Science Courses In Bangalore
    Data Science Institute In Bangalore

    Thank you..

    ReplyDelete
  25. This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the good work. I have been meaning to write something like this on my website and you have given me an idea.

    Data Science Course

    ReplyDelete
  26. Through this post, I know that your good knowledge in playing with all the pieces was very helpful. I notify that this is the first place where I find issues I've been searching for. You have a clever yet attractive way of writing.

    Data Science Training

    ReplyDelete
  27. Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!
    Data Science Certification in Bangalore

    ReplyDelete
  28. I finally found great post here.I will get back here. I just added your blog to my bookmark sites. thanks.Quality posts is the crucial to invite the visitors to visit the web page, that's what this web page is providing.
    data science training in indore

    ReplyDelete
  29. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
    Correlation vs Covariance
    Simple linear regression

    ReplyDelete
  30. I am always searching online for articles that can help me. There is obviously a lot to know about this. I think you made some good points in Features also. Keep working, great job !
    data science training in vijayawada

    ReplyDelete
  31. Attend The Data Analyst Course From ExcelR. Practical Data Analyst Course Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Data Analyst Course.
    Data Analyst Course

    ReplyDelete
  32. The Way Of Explaination Is Very Good And Nice Informative Topic You Have Choosen..
    AWS Course in Hyderabad

    ReplyDelete
  33. Such a very useful article. Very interesting to read this article. I would like to thank you for the efforts you had made for writing this awesome article.
    Data Science Course in Pune
    Data Science Training in Pune

    ReplyDelete
  34. I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.
    Data Analytics Course in Pune
    Data Analytics Training in Pune

    ReplyDelete
  35. I am impressed by the information that you have on this blog. It shows how well you understand this subject.
    Business Analytics Course in Pune
    Business Analytics Training in Pune

    ReplyDelete
  36. Attend The Data Analyst Course From ExcelR. Practical Data Analyst Course Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Data Analyst Course.
    Data Analyst Course

    ReplyDelete