ArduShapesArduShapes 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...
Shapes Programming ApplicationThe full ArdShapes application contains the following parts:
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.
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.
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.
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.
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 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.