Want an easy way to learn how to program the Arduino ?
Blocks it !!
Using just an Arduino Uno and an ArduinoBlocks website, you can easily build your program without need to remember the the programming syntax.
ArduinoBlocks have used the Google Blockly development code to create a block-based interface for the Arduino.
Currently, it supports the Arduino UNO, NANO and MEGA.
Note: You'll need a compatible Arduino board if you'd like to do the practical build at the end of this tutorial.
1.Head over to the ArduinoBlocks website.
2.We need to create an account before we can use it, but this means that all of our data and information is then stored in the cloud, so there’s less chance of having corrupted files.
-So we will start by being familiar with the arduinoBlocks environment.
Once logged-in we can create a new project by selecting the “Projects” drop down, located to the right of the ArduinoBlocks logo. Select “New project”, then start a personal project.
We now have a few options, the first of which is to select what our target platform will be. Fill out the relevant fields and how they relate to the project.
you’ll see that there are two functions already in the Blocks panel. If you have experimented with an Arduino before then you will be familiar with the Setup and Loop.
However if you have not, the Arduino code requires these two functions:
-The Setup fuction : selection of code that will be run when the unit first switches on used to set the pins configuration ( I/O ) or initialise the serial port for output.
-The loop function : is designed to loop forever (let's say while(1=1) do ).
Let’s take a moment to have a look at the Arduino Code palettes that are available. They include the basics, logic, control, variables and functions. However the really exciting part is that it includes so many options to control, servos, motors, SD cards, MQTT, GPS and even Bluetooth controls!
Now let's move on to our first test.
Find the Input/Output palette and drag the block that is titled “Write Digital Pin 2”.
Drag it over the loop function block until it snaps into place. Change the pin number to pin 13, which is the built-in LED on the Arduino.
Go to the Time palette and find the “Wait 1000 milliseconds” block.
Repeat the above block this time changing the state to “off” rather than “on”.
Add “Wait 1000 milliseconds” block again.
With this complete we need to upload our program onto the Arduino Uno
We have three options to load our program onto the Arduino UNO.
The first option is direct from the browser, where there is an option up the top left of the screen titled “upload”
but first you must install ArduinoBlocks-connector, sencode make sure your board is plugged into the USB port of your computer, then you can upload the program directly from the web by pressing upload.
In addition to this, if you click on the down arrow, next to the Blocks button in the top left, you will have the option to view the code, which can then be copied and pasted into the Arduino IDE.
We will use the third way, assuming you have installed the Arduino IDE, and download the .ino file.
So with our code successfully uploaded, the onboard LED will blink on and off every second.
Blocks programming is a lot of fun and very easy to get started with. The advent of Blockly has given us ArduinoBlocks,which can empower even the novice coder to create some impressive pieces of work.
If you have any question of course you can conctact me at : [email protected] , Or leave a comment.
Thanks for reading this instructable ^^ and have a nice day.
See ya.
Ahmed Nouira