The OpenMoko Freerunner ( and its predecessor the NEO1973 ) is a GSM smartphone with a 480x640 touchscreen, a GSM Modem, WLAN, BlueTooth and a GPS Receiver.[http://wiki.openmoko.org/images/b/b9/Freerunner02.gif] Hardware specs and schematics have been published. There are a couple of software stacks ( all based on a recent Linux kernel ) available. This includes a version of tck/tk ( in the 2007.2 stack this is version 8.4.11 ) For further information go to http://openmoko.org ----- The FreeRunner has two 3 axis accelerometers integrated. This script uses one to display attitude similar to a Spirit Level. Offset are at this stage hardcoded. #!/usr/bin/wish set acc [open /dev/input/event3 ] fconfigure $acc -encoding binary -translation binary -buffering none puts pastopen set ::X1 0 set ::Y1 0 set ::Z1 0 set cnt 0 set int 20 fileevent $acc readable { # puts preread set buf [read $acc 16] # puts postread binary scan $buf iissi tvsec tvusec type code value set ctime [expr {$tvsec + ($tvusec / 1e6)} ] # puts [format "% 8.1f %02x %02x % 8d" $ctime $type $code $value ] switch -glob -- $type,$code \ 2,0 { incr ::X1 $value } 2,1 { incr ::Y1 $value } 2,2 { incr ::Z1 $value } 0,* { if {([incr cnt] % $int)==0} { set ::X [expr {(0.0098 * $::X1 / $int) -0.58}] ; set ::X1 0 set ::Y [expr {(0.0098 * $::Y1 / $int) +0.17}] ; set ::Y1 0 set ::Z [expr {(0.0098 * $::Z1 / $int) +0.72}] ; set ::Z1 0 libelle xy $::X $::Y $::Z libelle xz $::X $::Z $::Y libelle zy $::Z $::Y $::X puts -nonewline [format "% 8.2f %8.2f % 8.2f cnt:% 8d \r" $::X $::Y $::Z $cnt] flush stdout # after 500 set cont 1 # vwait cont } } default { puts unknown:$type,$code/$value } } frame .f -width 480 -height 480 pack .f -expand 1 -fill both set range 10.50 scale .f.y -orient vertical -from -$range -to +$range -resolution 0.01 -variable ::Y -label Y -tickinterval 0.5 scale .f.x -orient horizontal -from +$range -to -$range -resolution 0.01 -variable ::X -label X -tickinterval 0.5 canvas .f.c -width 380 -height 380 -bg darkgray button .f.b -command exit -text Exit grid .f.x -column 0 -row 1 -sticky ew grid .f.y -column 1 -row 0 -sticky ns grid .f.c -column 0 -row 0 -sticky nsew grid .f.b -column 1 -row 1 -sticky nsew .f.c create oval {0 0 0 0} -fill red -tag xy .f.c create oval {0 0 0 0} -fill blue -tag xz .f.c create oval {0 0 0 0} -fill green -tag zy .f.c create line {170 0 170 390} -fill black .f.c create line {210 0 210 390} -fill black .f.c create line { 0 170 380 170} -fill black .f.c create line { 0 210 380 210} -fill black .f.c create line {150 0 150 390} -fill black .f.c create line {230 0 230 390} -fill black .f.c create line { 0 150 380 150} -fill black .f.c create line { 0 230 380 230} -fill black proc libelle {tag X Y Z} { set scale 20.0 set zscale 1.0 set xc [ expr {190 - (int(0.5+ ($X * $scale ))) }] set yc [ expr {190 + (int(0.5+ ($Y * $scale ))) }] set zc [ expr {20 + (int(0.5+ (($Z+10.0) * $zscale ))) }] set coords [ list [expr {$xc - $zc}] [expr {$yc - $zc}] [expr {$xc + $zc}] [expr {$yc + $zc}] ] .f.c coords $tag $coords } # working ---- [SL] 9/9/08: What is that? A FreeRunner? What does the script? ---- !!!!!! %| [Category Toys]|[Category Example] |% !!!!!!