arduino linux

Starting Arduino Uno with IDE on Linux

To start arduino programming go to web site and download arduino IDE software for linux. Choose linux 32 or 64 bit depend on your installed linux.

Extract downloaded archive.

Install it using root user (execute from extracted folder).


Tcl : Working with array

Lets start with running tcl script below to try out some array command :

set ar(1) one
set ar(2) two
set ar(3) three

puts array_size:[array size ar]
puts array_get:[array get ar]
puts array_names:[array names ar]

foreach {key} [array names ar] {set x $ar($key); puts $x}

On example above we use 3 array subcommand :


Tcl : Creating Array

Tcl array can be created by set command by specifying its key to array name.

From example above we define array named days with keys containing numbers and text values. If we try to do variable substitution with $days, it wont work. If we do variable substitution with key specified then it will work.

We can have text as array’s key. Tcl array is an associative array.

From sample above we know that a text key is case sensitive (ID is different with id).

Another way to create array is with array set command by passing list of key value pairs as 3rd parameter and array name as 2nd parameter.

Thats all how we create array in Tcl. Bye!


Tcl : While command

Basic syntax for while command in tcl language is

while test body

Tcl also have break and continue command as found on other language to control looping. Break within body will exit the loop. Continue will stop executing body and reevaluate the test.

Consider below sample :


Tcl : for command

For command used on tcl to create looping with syntax below :

for start test next command

for command have 4 parameter. The first parameter is start block where we set an initial value to a variable (usually using set command). Second parameter is test block where we test a variable or condition(will be tested using expr command). The third parameter is next block which usually used to change variable value (can use incr command). The fourth parameter is command which will be executed in loop.

Basic example below , using i as variable :


Tcl : foreach command

Foreach command used to execute tcl scripts for every element of one or more lists. The basic syntax is below :

foreach varname list script

To iterate on a list and show element value on screen :