Introduction: Learns or Teaches Arduino Without Any Line of Code # 2

About: Teacher in Comunity College. Instructor en un Centro de Capacitación.

Hello everyone, this is the second Arduino tutorial on how to program without writing any line of code, using Ardublock, which is an extension of the Arduino IDE for visual programming. If this is the first time you use Ardublock, please visit the first part of this project in this link:

https://www.instructables.com/id/Learns-or-Teaches-Arduino-Without-Any-Line-of-Code/

This time, you will learn how to program Arduino, so that when you press a button and while this remains powered LED lights.

You'll also use new programming blocks such as:

Store values in a variable.

Conditional If / else.

Read a digital input

Write a digital output.

It looks complicated, but really that Ardublock be very simple.

Step 1: List of Parts.

1 SparkFun Redboard (Arduino/Genuino).

1 330 Ohm Resistor.

1 10 Kohm Resistor

1 Led

1 PushButton

1 Breadboard

4 Wires

Step 2: Make the Circuit.

This is an illustration of how the completed circuit should look.

Components like resistors need to have their legs bent into 90° angles in order to correctly fit the breadboard sockets.

Ready to start hooking everything up? Check out the Fritzing diagram and hookup table below, to see how everything is connected.

Warning:

Pay special attention to the component’s markings indicating how to place it on the breadboard. Polarized components can only be connected to a circuit in one direction.

Step 3: Start Arduino IDE and Ardublock.

1.- Double clic on Arduino IDE icon.

2.- Select the Board and Serial Port – Just as you would if you were using Arduino, make your board and serial port selections from the “Tools” menu.

3.- Open ArduBlock by clicking Tools > ArduBlock. If you don’t see an entry for ArduBlock here, double-check to make sure your directories are all correctly typed and cased.

Ardubloc will open in a second window, as shown in the following figure.

Caution Ardublock depends of Arduino IDE, do not close it.

Step 4: Create the Program.

Now you will create the program to Light a LED with a pushbutton.

1.- Click the category Control And drag the block Program.

2.- Click the category Control And drag the block if/else, under the block program.

3.- Click the category Variables/Constants And drag the block set digital variable.

4.- Set the digital variable name to button1.

5.- Drag the block if/else under the digital variable name, until join.

6.- Click the category Pins And drag the block Digital pin #, and change de value to 10.

7.- Drag and Drop the block HIGH, somewhere in the RIGHT panel, don't delete, you need them more later.

8.- Put the block digital pin # in the value space of set digital variable until join.

9.- Click the category Test And drag the block == (equal to) Comparison Operator.

10.- Clone the block button1 and drag to the first position of the Block == (Equal to).

11.- Change the Value in the block HIGH to LOW and Drag to the second position of the Block == (Equal to).

Note.- There are two types of buttons, normally open and normally closed, will have to change the value to HIGH or LOW as appropriate.

12.- Click the category Pins And drag the block set digital pin #, and change de value to 12.

13.- Clone block set digital pin #, and change de value HIGH to LOW.

14.- Now put all together in the block if/else, as show in the figure.

15.- Drag the block set digital variable, over the block if/else until them join.

16.- Finally drag the set of blocks in the loop section of the main "program" block.

Step 5: End.

And that’s all my friends, now upload the program and try to Light a LED with the pushbutton.

Regards

P.S. Thanks to all persons they saw and follow my projects on Instructables, this motivates me to do more. If you pay attention, they listen to a nice woman in the video.