English (United Kingdom) Hebrew

ArduShapes

ArduShapes is a programming environment for learning and programming in Arduino. ArduShapes applies a visual drag-and-drop programming style, easy and intuitive for learning. Full window...
Contents

Shapes Programming Application

The full ArdShapes application contains the following parts:
  • Editing area (in the center of the application window): this is the main window, where instructions are dropped and edited. The program written here will be uploaded to the robot when hitting the "Upload to Robot!" button.
  • Instruction menu: the instruction menu contains several menus to select from: robot, control, logic, etc. These menus contain instructions which the user can drag and drop into the editing area.


Sample Programs

Blink

The program cause the TX led on the robot controller to blink. The blinking is implemented by writing 1 to the TX led, waiting for 1 second (1000 milliseconds) and then turn it off by writing 0 to it, again for 1 second. As the blinking is done on the loop() function, the blinking is infinite. The loop() function is called by the Arduino system repeatedly and infinitely.
Note that for using the TX pin as an output, its OUTPUT mode is set on the setup() function: this is where the initialization setup of the program is done.

Blink in a loop

In this program we cause the led to blink 4 times only, using the repeat instruction: the number set at the top part states how many times to execute the instructions contained within the repeat instruction block.
Note that the blinking code was moved from the loop() function to the setup() function, so that we can control the number of times it is executed.

Serial print

Print digital pin 14 value to serial channel. The printed values can be seen in the serial monitor, which can be opened by clicking the "Serial Monitor" in the toolbar.

Turning on the motors: forward

A DC motor is configured by initializing the PWM pin, the d0 and d1 pins which control the motor direction, and the clockwise direction.

To set two motors to move forward we set the second motor with a clockwise parameter set to false, so that when giving same value to the motors both will move forward.

LCD

The program sets an LCD with arguments rs (register select), en (enable), and with the four d4-d7 data pins.

The program writes to the LCD the number of milliseconds passed since the start of the run, using the millis instruction.

Interrupts

This program increments and prints the value of a variable each time pin 13 goes down from HIGH to LOW (FALLING). This is done using the interrupt instruction, which is used to define a block of instructions to execute when a pin value rises, falls or changes.

Write to and Read from Flash Memory

The flash memory is used to store values in a persistent storage, retaining these values even when there is no power supply. The memory size on standard Arduinos is 512 bytes, thus the program writes in a loop of 512 times the loop index modulo 256.

Functions

Functions let the user write modular programs. The program part within a function can be executed from anywhere in the program by calling that function.
This program demonstrates writing of functions with arguments, and call functions from other functions.