<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-516495489023883673</id><updated>2011-09-26T23:37:31.495-07:00</updated><category term='flash'/><category term='sonar'/><category term='installation'/><category term='ArrayList'/><category term='compass sensor'/><category term='gearbox'/><category term='light'/><category term='scorpion'/><category term='PSP-NX'/><category term='GLOVEPIE'/><category term='stalking'/><category term='scaling'/><category term='drawdio'/><category term='bike'/><category term='troubleshooting'/><category term='arnold'/><category term='PCF8574'/><category term='classes'/><category term='laserharp'/><category term='firmware'/><category term='eclipse'/><category term='nxtcam'/><category term='nxt-model'/><category term='letters'/><category term='balance'/><category term='fantom lib'/><category term='tekenen'/><category term='sites'/><category term='getallen'/><category term='metingen'/><category term='java'/><category term='sensoren'/><category term='FLOCS'/><category term='distance sensors'/><category term='hacking keyboard'/><category term='tilt'/><category term='Dev Cpp'/><category term='blockeditor'/><category term='compass'/><category term='ideas'/><category term='links'/><category term='wiiflash'/><category term='radar'/><category term='wii remote'/><category term='tiltsensor'/><category term='follow'/><category term='building'/><category term='fantom API'/><category term='emmanuel pirsch'/><category term='quickstart'/><category term='programme'/><category term='tinkerproxy'/><category term='Hopper'/><category term='environmetal variables'/><category term='Liquid crystal'/><category term='lejos'/><category term='BramFokke'/><category term='set up'/><category term='base model'/><category term='bootloader'/><category term='clock sensor'/><category term='acceleration'/><category term='PSP'/><category term='map'/><category term='playstation'/><category term='I2CSensor'/><category term='fileIO'/><category term='commandwindow'/><category term='master slave'/><category term='phidget reader'/><category term='555'/><category term='comport'/><category term='nxt'/><category term='sound'/><category term='sensors'/><category term='lightsensor'/><category term='relais'/><category term='Laurens'/><category term='vector'/><category term='menu'/><category term='Arra'/><category term='rfid'/><category term='arduino'/><category term='WD-C2704M'/><category term='LEJOS JAVA'/><category term='long'/><category term='PCF8574A'/><category term='drawing'/><category term='php'/><category term='main'/><category term='relay'/><category term='webfun'/><category term='wii'/><category term='devCpp'/><category term='Direct Commands'/><category term='mapping'/><category term='visual C++'/><category term='motor'/><category term='sliding'/><category term='button'/><category term='camera senosr'/><category term='time'/><category term='C#'/><category term='bluetooth'/><category term='clock'/><category term='languages'/><category term='sensor'/><category term='server'/><category term='serproxy'/><title type='text'>NXT - Arduino -  homebrew</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>68</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-1224598065701902297</id><published>2011-07-24T01:27:00.000-07:00</published><updated>2011-07-24T01:27:37.750-07:00</updated><title type='text'>Saving space with strings</title><content type='html'>Also a diary entry:&lt;br /&gt;How to save space on Strings using the FLASH memory of an ATmega &lt;br /&gt;&lt;a href="http://jeelabs.org/2011/05/23/saving-ram-space/"&gt;http://jeelabs.org/2011/05/23/saving-ram-space/ &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is a usefull post, but for one thing: it does not explain the PSTR()&lt;br /&gt;&lt;br /&gt;This turns out to be handled with a little care, so no&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Serial.println(PSTR("hello");&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;will work, as explained here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://arduino.cc/forum/index.php?action=printpage;topic=50197.0"&gt;http://arduino.cc/forum/index.php?action=printpage;topic=50197.0&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Ad you learn something about addresses and seperate parts of the Harvard architecture&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-1224598065701902297?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/1224598065701902297/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=1224598065701902297' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/1224598065701902297'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/1224598065701902297'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2011/07/saving-space-with-strings.html' title='Saving space with strings'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-402472396700785236</id><published>2011-07-24T00:36:00.000-07:00</published><updated>2011-07-24T00:36:13.979-07:00</updated><title type='text'>ethernetshield arduino, jeenode</title><content type='html'>This stuff is all known, and this post is just a diary, remembering how to do it all.&lt;br /&gt;&lt;br /&gt;Arduino has its own ethernetshield.&lt;br /&gt;&lt;a href="http://arduino.cc/en/Tutorial/WebServer"&gt;http://arduino.cc/en/Tutorial/WebServer &lt;/a&gt;&lt;br /&gt;We also have the ethercard from Jeelabs.com&lt;br /&gt;&amp;nbsp;&lt;a href="http://jeelabs.org/2010/05/24/meet-the-ether-card/"&gt;http://jeelabs.org/2010/05/24/meet-the-ether-card/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We have a modem, so how to connect what with what and what about IP?&lt;br /&gt;&lt;br /&gt;&lt;a href="http://electronics.stackexchange.com/questions/15150/what-does-the-arduino-ethernet-shield-connect-to"&gt;http://electronics.stackexchange.com/questions/15150/what-does-the-arduino-ethernet-shield-connect-to&lt;/a&gt;&lt;br /&gt;this link has a nice setup explanation.&lt;br /&gt;&lt;br /&gt;I don't have a crossover cable, so I connected to the modem.&lt;br /&gt;Then with the Arduino Ethernetshield, what worked was the example of the reading of the analog PINS.&lt;br /&gt;&lt;br /&gt;With the jeenode ethercard setup of jeelabs the DHCP did not work for me, (probably the settings of the modem)&lt;br /&gt;&lt;a href="http://jeelabs.org/2011/06/19/ethercard-library-api/"&gt;http://jeelabs.org/2011/06/19/ethercard-library-api/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;but using the static IP:&lt;br /&gt;&lt;br /&gt;&lt;code&gt; // ethernet interface mac address&lt;br /&gt;static byte mymac[] = { 0xDE,0xAD,0xBE,0xEF,0xFE,0x19 };&lt;br /&gt;// ethernet interface ip address&lt;/code&gt;&lt;br /&gt;&lt;code&gt;static byte myip[] = { 192,168,2,77 };&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;and in the setup:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;void setup(){&lt;br /&gt;ether.begin(sizeof Ethernet::buffer, mymac);&lt;br /&gt;//ether.dhcpSetup();&lt;br /&gt;ether.staticSetup(myip, gwip);&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;we got the "backsoon page".&lt;br /&gt;&lt;br /&gt;That is, we got it at http://192.168.2.77/ which is still local network.&lt;br /&gt;&lt;br /&gt;The last hurdle is to connect to this "server" from the outside.&lt;br /&gt;&lt;br /&gt;You can see which IP you have in ipconfig in the terminal, or using&lt;br /&gt;&lt;a href="http://www.whatismyip.com/"&gt;http://www.whatismyip.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then in our case, you have to get to your modem using the browser, (IP number&amp;nbsp; in ipconfig)&lt;br /&gt;advanced settings&lt;br /&gt;internet&lt;br /&gt;Address translation&lt;br /&gt;port forwarding&lt;br /&gt;and add the port whcih is in the arduino script, and the local ip of the arduino server.&lt;br /&gt;&lt;br /&gt;Then you can reach the arduino internet page, from outside, and the arduino becomes a real server.&lt;br /&gt;(Strange enough, no problems with the firewall....)&lt;br /&gt;&lt;br /&gt;Working on XP, so Windows.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-402472396700785236?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/402472396700785236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=402472396700785236' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/402472396700785236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/402472396700785236'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2011/07/ethernetshield-arduino-jeenode.html' title='ethernetshield arduino, jeenode'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-7489367401991555143</id><published>2010-06-07T06:49:00.001-07:00</published><updated>2010-06-07T08:45:19.289-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='compass sensor'/><title type='text'>Compass sensors</title><content type='html'>Some students wanted to make a real catapult which throws virtual objects into a virtual world.&lt;br /&gt;&lt;br /&gt;Some considerations were given to calibrating the direction of the catapult using a compass sensor.&lt;br /&gt;&lt;br /&gt;We did some searching to find the cheapest way to get (I2C) information from a compass sensor:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.magnetometer.org/mag-magnetoresistive.php" target="_blank"&gt;http://www.magnetometer.org/&lt;wbr&gt;mag-magnetoresistive.php&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;HMC1051, a Honeywell chip&lt;span style="font-size:100%;"&gt;&lt;br /&gt;KMZ10B/B MAGNETFELDSENSO, but then you have to go building&lt;br /&gt;( only 4.56 euro at conrad.nl )&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://www.convict.lu/Jeunes/CompassSensor.htm" target="_blank"&gt;http://www.convict.lu/Jeunes/&lt;wbr&gt;CompassSensor.htm&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.sparkfun.com/commerce/product_info.php?products_id=7892" target="_blank"&gt;http://www.sparkfun.com/&lt;wbr&gt;commerce/product_info.php?&lt;wbr&gt;products_id=7892&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.antratek.nl/Compass-modules.html" target="_blank"&gt;http://www.antratek.nl/&lt;wbr&gt;Compass-modules.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;so the cheapest ready made sensor seems to be around 23 euro's and then sending costs...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-7489367401991555143?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/7489367401991555143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=7489367401991555143' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7489367401991555143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7489367401991555143'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2010/06/compass-sensors.html' title='Compass sensors'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-619018958196441859</id><published>2010-03-19T02:06:00.000-07:00</published><updated>2010-03-19T02:35:46.097-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='555'/><category scheme='http://www.blogger.com/atom/ns#' term='drawdio'/><title type='text'>music pencil drawing: drawdio</title><content type='html'>&lt;div class="entry"&gt;      &lt;p&gt;While looking for  a way to imitate a bird sound with a 555  timer or a Atiny something, this funny thing came out:&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.ladyada.net/make/drawdio/user.html"&gt;http://www.ladyada.net/make/drawdio/user.html  &lt;/a&gt;&lt;/p&gt;  &lt;p&gt;making sounds while drawing, you have to stay in touch with the drawing too, because you are part  of the electronic circuitry!&lt;/p&gt; &lt;p&gt;&lt;a href="http://web.media.mit.edu/%7Esilver/drawdio/"&gt;http://web.media.mit.edu/~silver/drawdio/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;based on a 555 or 551 timer&lt;/p&gt; &lt;p&gt;looks like the idea of the pencil connections could be modified and  expanded easily, for instance with the Darlington pair and an ARDUINO  connection, triggering “drawing input” and  using it to steer FLASH  movies….&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;     &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-619018958196441859?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/619018958196441859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=619018958196441859' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/619018958196441859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/619018958196441859'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2010/03/music-pencil-drawing-drawdio.html' title='music pencil drawing: drawdio'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-7534604979983783208</id><published>2010-02-17T13:31:00.001-08:00</published><updated>2010-02-17T13:31:38.927-08:00</updated><title type='text'>connecting to USB</title><content type='html'>The USB port can be used to power a chip, ATTINY, ATM168 and send/receive data at the same time.&lt;br /&gt;&lt;br /&gt;You can connect to FLASH for instance using serial proxy.&lt;br /&gt;You can connect sensors to the chip and send the data to the laptop.&lt;br /&gt;You can build your own buttonboard (usb interface keyboard)&lt;br /&gt;And also you can build your own programmer!&lt;br /&gt;&lt;br /&gt;The only things you need is a chip, USB connector, a few zenerdiodes and resistors, capacitors.&lt;br /&gt;&lt;br /&gt;links: &lt;a href="http://www.obdev.at/products/vusb/index.html"&gt;http://www.obdev.at/products/vusb/index.html &lt;/a&gt;(with lots of example projects!)&lt;a href="http://www.obdev.at/products/vusb/index.html"&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;to make your own programmer:  &lt;a href="http://www.fundf.net/usbasp/"&gt;http://www.fundf.net/usbasp/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;or to order a DIY kit, about 17 euro.....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-7534604979983783208?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/7534604979983783208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=7534604979983783208' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7534604979983783208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7534604979983783208'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2010/02/connecting-to-usb.html' title='connecting to USB'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-2662815945425133578</id><published>2010-02-17T13:13:00.001-08:00</published><updated>2010-02-17T13:13:53.210-08:00</updated><title type='text'></title><content type='html'>Russian is not as difficult as it seems (sometimes :-)&lt;br /&gt;&lt;br /&gt;if you like AVR and ARDUINO's what can ever stop you???&lt;br /&gt;&lt;br /&gt;we start with LOVE:&lt;br /&gt;&lt;br /&gt;я люблю контроллеры &lt;strong&gt;AVR&lt;/strong&gt;  : i love AVR microcontrollers&lt;br /&gt;&lt;br /&gt;Then just for fun a few basic words (most of these words - pronounce them and you know what it is...)&lt;br /&gt;&lt;br /&gt;вольт: volt&lt;br /&gt;&lt;br /&gt;Конденсаторы: capacitor, (condensator)&lt;br /&gt;Резистор: resistor&lt;br /&gt;диод: diode&lt;br /&gt;светодиод: LED, literally "light diode"&lt;br /&gt;транзистор: transistor&lt;br /&gt;кнопка: button (knopje in Dutch!)&lt;br /&gt;регистр: registry, memory place like R15 etc&lt;br /&gt;вход с подтяжкой: pullUp port&lt;br /&gt;порт-земля: GND, literally port ground&lt;br /&gt;порт-питание:  VCC&lt;br /&gt;лаборатория: laboratory&lt;br /&gt;Подключение: connections,  ключ = key&lt;br /&gt;контроллер  AVR: AVR controller&lt;br /&gt;архитектуре контроллера AVR : AVR architecture&lt;br /&gt;Ассемблер assembler&lt;br /&gt;порты ввода вывод, input output ports&lt;br /&gt;даташит, datasheet&lt;br /&gt;&lt;br /&gt;Если что непонятно, то не стесняйся спрашивать у меня в комментах.  : If all this was not clear, ask me about it in the comments :-)&lt;br /&gt;&lt;br /&gt;If you don't believe me look here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://easyelectronics.ru/podklyuchenie-mikrokontrollera-likbez.html"&gt;http://easyelectronics.ru/podklyuchenie-mikrokontrollera-likbez.html &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;He makes interesting art too:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blog.wdka.nl/crosslab-diy/files/2010/01/russian.jpg" title="russian.jpg"&gt;&lt;img src="http://blog.wdka.nl/crosslab-diy/files/2010/01/russian.jpg" alt="russian.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;this is a good translator, most of the text was not poetical spaghetti:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.online-translator.com/Default.aspx/Text"&gt;http://www.online-translator.com/Default.aspx/Text &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-2662815945425133578?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/2662815945425133578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=2662815945425133578' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2662815945425133578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2662815945425133578'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2010/02/russian-is-not-as-difficult-as-it-seems.html' title=''/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-7191859333328593014</id><published>2010-02-17T13:09:00.000-08:00</published><updated>2010-02-17T13:10:26.466-08:00</updated><title type='text'>inspired by the movie AVATAR</title><content type='html'>Apparently people in the States are much favored: they can do the blue avatar happyness and electronics AND eating fast food at the same time:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.robotroom.com/Inside-Avatar-McDonalds-Toy.html"&gt;http://www.robotroom.com/Inside-Avatar-McDonalds-Toy.html &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;(poor little blue fellow though :-(&lt;br /&gt;He will be taken apart!&lt;br /&gt;&lt;br /&gt;See the nice blue images on this site!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-7191859333328593014?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/7191859333328593014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=7191859333328593014' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7191859333328593014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7191859333328593014'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2010/02/inspired-by-movie-avatar.html' title='inspired by the movie AVATAR'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-482268163129057706</id><published>2010-02-17T13:05:00.000-08:00</published><updated>2010-05-14T04:33:04.511-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='distance sensors'/><title type='text'>Distance sensors</title><content type='html'>Distance sensors are relatively expensive.&lt;br /&gt;&lt;br /&gt;Here is a list of some of the cheapest:&lt;br /&gt;&lt;br /&gt;Infrared:&lt;br /&gt;&lt;br /&gt;small distances:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://home.cogeco.ca/%7Erpaisley4/IrProximity.html"&gt;http://home.cogeco.ca/~rpaisley4/IrProximity.html &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;intermediate:&lt;br /&gt;&lt;br /&gt;SHARP GP2D12: (10-80 cm) examples and connections:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.acroname.com/robotics/parts/R48-IR12.html"&gt;http://www.acroname.com/robotics/parts/R48-IR12.html &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;(can be bought at &lt;a href="http://www.conrad.nl/"&gt;www.conrad.nl&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;ultrasound: ( from 10 cm to 255 cm )&lt;br /&gt;&lt;br /&gt;SRF02 series&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;I had a problem with too stiff wires, and I had really to get the MODE pin HIGH to get it functioning&lt;br /&gt;This script is showing how:&lt;br /&gt;&lt;a href="http://www.tigoe.net/pcomp/code/category/arduinowiring/39"&gt;http://www.tigoe.net/pcomp/code/category/arduinowiring/39&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Because it is I2C you can add this to other I2C devices on pins 4 and 5 analog of the Arduino&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.antratek.nl/Ultrasonic-sensors.html"&gt;http://www.antratek.nl/Ultrasonic-sensors.html &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;There is an inexpensive one I have built from a kit:&lt;br /&gt;(dutch: Ultrasoon Afstandsalarm)&lt;br /&gt;&lt;br /&gt;Ultrasonic distance warning&lt;br /&gt;&lt;br /&gt;www.conrad.nl article number 114456&lt;br /&gt;but this is for warning between 10 - 80 cm, not really measuring distance.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-482268163129057706?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/482268163129057706/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=482268163129057706' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/482268163129057706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/482268163129057706'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2010/02/distance-sensors.html' title='Distance sensors'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-2114631360062799654</id><published>2009-12-31T22:02:00.000-08:00</published><updated>2009-12-31T22:13:13.136-08:00</updated><title type='text'>linux starter links</title><content type='html'>&lt;a href="http://www.cyberciti.biz/faq/ubuntu-linux-root-password-default-password/"&gt;http://www.cyberciti.biz/faq/ubuntu-linux-root-password-default-password/&lt;/a&gt;&lt;br /&gt;&lt;a href="https://help.ubuntu.com/6.06/ubuntu/desktopguide/C/apt-get.html"&gt;https://help.ubuntu.com/6.06/ubuntu/desktopguide/C/apt-get.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://linuxreviews.org/beginner/"&gt;http://linuxreviews.org/beginner/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;working with ubuntu in the terminal window the problem was how to get to the root user to get things installed.&lt;br /&gt;&lt;br /&gt;basically:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;sudo bash&lt;br /&gt;&lt;/code&gt;&lt;code&gt;sudo -s&lt;br /&gt;&lt;br /&gt;then to get a file executable:&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;code&gt;chmod a+x someFile&lt;br /&gt;&lt;br /&gt;to copy files from somewhere to there:&lt;br /&gt;&lt;br /&gt;cp somewhere there&lt;br /&gt;&lt;br /&gt;somwhere and there being path/someFileName&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-2114631360062799654?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/2114631360062799654/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=2114631360062799654' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2114631360062799654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2114631360062799654'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/12/linux-starter-links.html' title='linux starter links'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-2921417818549738841</id><published>2009-07-07T08:16:00.000-07:00</published><updated>2011-07-24T00:40:11.640-07:00</updated><title type='text'>8 x 8 LED Display</title><content type='html'>Remark: In this post we use the frequency timer library, which was only working for the ATmega168. Better use the "real AVR" interrupt immediately...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Some time ago we bought the &lt;a href="http://www1.conrad.nl/fas6/fh.php?fh_host=http://www1.conrad.nl&amp;amp;fh_session=/scripts/wgate/zcop_nl3/%7EflN0YXRlPTc3MzgyOTc5MA==?&amp;amp;fh_pic_url=//media.conrad.com&amp;amp;layout=b2c&amp;amp;finder=&amp;amp;fh_params=fh_eds%3D%25c3%259f%26fh_start_index%3D50%26fh_search%3Dled%2Bdisplay%26fh_secondid%3Dnl2156380%26fh_lister_pos%3D89%26fh_location%3D%252f%252fb2cconrad_nl_b2c%252fnl_NL%252f%2524s%253dled%255cu0020display%26fh_refview%3Dsearch" mce_href="http://www1.conrad.nl/fas6/fh.php?fh_host=http://www1.conrad.nl&amp;amp;fh_session=/scripts/wgate/zcop_nl3/%7EflN0YXRlPTc3MzgyOTc5MA==?&amp;amp;fh_pic_url=//media.conrad.com&amp;amp;layout=b2c&amp;amp;finder=&amp;amp;fh_params=fh_eds%3D%25c3%259f%26fh_start_index%3D50%26fh_search%3Dled%2Bdisplay%26fh_secondid%3Dnl2156380%26fh_lister_pos%3D89%26fh_location%3D%252f%252fb2cconrad_nl_b2c%252fnl_NL%252f%2524s%253dled%255cu0020display%26fh_refview%3Dsearch"&gt;LED DISPL. GR  2 3"  8X8 MATRI&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www1.conrad.nl/fas6/fh.php?fh_host=http://www1.conrad.nl&amp;amp;fh_session=/scripts/wgate/zcop_nl3/%7EflN0YXRlPTc3MzgyOTc5MA==?&amp;amp;fh_pic_url=//media.conrad.com&amp;amp;layout=b2c&amp;amp;finder=&amp;amp;fh_params=fh_eds%3D%25c3%259f%26fh_start_index%3D50%26fh_search%3Dled%2Bdisplay%26fh_secondid%3Dnl2156380%26fh_lister_pos%3D89%26fh_location%3D%252f%252fb2cconrad_nl_b2c%252fnl_NL%252f%2524s%253dled%255cu0020display%26fh_refview%3Dsearch" mce_href="http://www1.conrad.nl/fas6/fh.php?fh_host=http://www1.conrad.nl&amp;amp;fh_session=/scripts/wgate/zcop_nl3/%7EflN0YXRlPTc3MzgyOTc5MA==?&amp;amp;fh_pic_url=//media.conrad.com&amp;amp;layout=b2c&amp;amp;finder=&amp;amp;fh_params=fh_eds%3D%25c3%259f%26fh_start_index%3D50%26fh_search%3Dled%2Bdisplay%26fh_secondid%3Dnl2156380%26fh_lister_pos%3D89%26fh_location%3D%252f%252fb2cconrad_nl_b2c%252fnl_NL%252f%2524s%253dled%255cu0020display%26fh_refview%3Dsearch"&gt;Bestnr.:  156380 - 8A&lt;/a&gt; at conrad.nl.&lt;br /&gt;Very important you can download the datasheet at conrad service.&lt;br /&gt;First we thought it would be easy to connect the 16 pins, steering 64 LED's. But it proved to be a bit more complicated than we thought. (As usual.)&lt;br /&gt;Looking at the connections you see that you can light one LED, but how to get a pattern running across the matrix of 8 x 8 LED's.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_Jq__kevBr8s/SlO-Yg0nreI/AAAAAAAABUs/sfkxNiWBVdg/s1600-h/led1.jpg" mce_href="http://3.bp.blogspot.com/_Jq__kevBr8s/SlO-Yg0nreI/AAAAAAAABUs/sfkxNiWBVdg/s1600-h/led1.jpg"&gt;&lt;img border="0" mce_src="http://3.bp.blogspot.com/_Jq__kevBr8s/SlO-Yg0nreI/AAAAAAAABUs/sfkxNiWBVdg/s400/led1.jpg" src="http://3.bp.blogspot.com/_Jq__kevBr8s/SlO-Yg0nreI/AAAAAAAABUs/sfkxNiWBVdg/s400/led1.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;Some tricks are needed!&lt;br /&gt;We have to use a fast timer, from a CPP lib to fool the eye of the beholder, working with the slow response time of the eye. Indeed a camera sees more, which can be seen in the pictures.&lt;br /&gt;here we found the necessary info: &lt;a href="http://www.arduino.cc/playground/Main/DirectDriveLEDMatrix" mce_href="http://www.arduino.cc/playground/Main/DirectDriveLEDMatrix"&gt;http://www.arduino.cc/playground/Main/DirectDriveLEDMatrix&lt;/a&gt;&lt;br /&gt;but the FrequencyTimer2.h did not compile right away, we had to modify some lines using advice from here:&lt;br /&gt;&lt;a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1239820770" mce_href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1239820770"&gt;http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1239820770&lt;/a&gt;&lt;br /&gt;then we still had a problem, we dived into the CPP file, we encountered some things we didn't really understand.....we tried several changes....&lt;br /&gt;...&lt;br /&gt;...***&lt;br /&gt;...&lt;br /&gt;then as a final try we changed the HIGH in the LOW everywhere in the ARDUINO script, and it worked, why?&lt;br /&gt;comparing the datasheets we noticed that ...indeed...the LED's were turned around, in our device they were in the other way around, compared to the LED matrix used in the script of the link.....&lt;br /&gt;:-(, always the same.....look closer, expect changes everywhere, details details....&lt;br /&gt;but ok, in the end....it worked within a day, and the script is great!&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_Jq__kevBr8s/SlO-YzIrvfI/AAAAAAAABU0/bRvluwofZ7c/s1600-h/led2.jpg" mce_href="http://4.bp.blogspot.com/_Jq__kevBr8s/SlO-YzIrvfI/AAAAAAAABU0/bRvluwofZ7c/s1600-h/led2.jpg"&gt;&lt;img border="0" mce_src="http://4.bp.blogspot.com/_Jq__kevBr8s/SlO-YzIrvfI/AAAAAAAABU0/bRvluwofZ7c/s400/led2.jpg" src="http://4.bp.blogspot.com/_Jq__kevBr8s/SlO-YzIrvfI/AAAAAAAABU0/bRvluwofZ7c/s400/led2.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;(In this last image the camera sees what the eye cannot see: the LED steered on and off faster than we can see.) Our plan is to built this LED matrix into clothing behind a half transparent outer layer. Use a distance sensor, and change the running text according to distance of others from ourselves...&lt;br /&gt;*** Peter van Vliet explained the (for me) incomprehensible part in the C++ file of the FrequencyTimer2 lib.&lt;br /&gt;What was the problem? We noticed this part at the top of the source file:&lt;br /&gt;{&lt;br /&gt;static uint8_t inHandler = 0; // protect us from recursion if our handler enables interrupts&lt;br /&gt;if ( !inHandler &amp;amp;&amp;amp; FrequencyTimer2::onOverflow) {&lt;br /&gt;inHandler = 1;&lt;br /&gt;(*FrequencyTimer2::onOverflow)();&lt;br /&gt;inHandler = 0;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;without a function name....&lt;br /&gt;The explanation is that this part will be flashed in the first part of the program section on top op everything else. It will be called every cycle, which makes sense seeing the purpose of the FrequencyTimer2 lib. So this is special chip (embedded) programming.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-2921417818549738841?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/2921417818549738841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=2921417818549738841' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2921417818549738841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2921417818549738841'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/07/8-x-8-led-display.html' title='8 x 8 LED Display'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Jq__kevBr8s/SlO-Yg0nreI/AAAAAAAABUs/sfkxNiWBVdg/s72-c/led1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-7724401572564962214</id><published>2009-06-25T13:15:00.000-07:00</published><updated>2009-06-25T21:08:20.386-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WD-C2704M'/><category scheme='http://www.blogger.com/atom/ns#' term='Liquid crystal'/><title type='text'>Liquid crystal display WD-C2704M and the ARDUINO</title><content type='html'>Some time ago we bought a liquid crystal display WD-C2704M. It was a cheap one with 4 lines of possible text.&lt;p&gt;Of course there are a lot of liquid crystal, some preprogrammed, some with nice connected wires etc, the best (probably the most expensive too :-)&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.eink.com/press/releases/pr87.html"&gt;http://www.eink.com/press/releases/pr87.html&lt;/a&gt;&lt;/p&gt;&lt;p&gt;But back to our thing the WD-C2704M, of about 5 euro's....&lt;a href="http://www.eink.com/press/releases/pr87.html"&gt;at www.pollin.de&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;It came with a the wires in a special flat plastic setting:&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Jq__kevBr8s/SkRGlfLgt0I/AAAAAAAABUk/tr_ol71nkOY/s1600-h/WINTEK.jpg"&gt;&lt;img style="cursor: pointer; width: 300px; height: 225px;" src="http://4.bp.blogspot.com/_Jq__kevBr8s/SkRGlfLgt0I/AAAAAAAABUk/tr_ol71nkOY/s320/WINTEK.jpg" alt="" id="BLOGGER_PHOTO_ID_5351479867061876546" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;we should have bought the special slot for this, but we soldered, and all wires got mixed up, because they came loose from the ground....we scratched holes in the plastic isolation and succeeded in soldering the wires again. This already made the task daunting: around 20 wires so close together!&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;It took a while to find the specs. (Because we didn't buy it at pollins, there the datasheets can be found easily, we also paid tooo much at the other place (about 10 euro too much) haha!). Documentations are in German. No problem for the dutch...&lt;/p&gt; &lt;p&gt;WD-C2704M-1HNN.pdf&lt;br /&gt;Text-LCDs.pdf&lt;/p&gt; &lt;p&gt;the pins of the display:&lt;/p&gt; &lt;p&gt;&lt;a onblur="return true;try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Jq__kevBr8s/SkPh3JBj8XI/AAAAAAAABUU/mxAiX-N9rew/s1600-h/pins.jpg" mce_href="http://1.bp.blogspot.com/_Jq__kevBr8s/SkPh3JBj8XI/AAAAAAAABUU/mxAiX-N9rew/s1600-h/pins.jpg"&gt;&lt;img src="http://1.bp.blogspot.com/_Jq__kevBr8s/SkPh3JBj8XI/AAAAAAAABUU/mxAiX-N9rew/s320/pins.jpg" style="cursor: pointer; width: 320px; height: 112px;" id="BLOGGER_PHOTO_ID_5351369119677804914" mce_src="http://1.bp.blogspot.com/_Jq__kevBr8s/SkPh3JBj8XI/AAAAAAAABUU/mxAiX-N9rew/s320/pins.jpg" border="0" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;The display is HD44780 compatible, indeed it should be a double separated display. How to program this?&lt;br /&gt;There is a liquid crystal lib for the ARDUINO. But this one is for 4 or 8 bits, so a max of two lines. This display has 4 lines.&lt;br /&gt;We could make a new CPP lib out of the liquidCrystal.h, using the Cpp in the folder hardware\libraries\LiquidCrystal of the ARDUINO files.&lt;br /&gt;This was our first try, following the instructions carefully of the setting up. We tried to set the display up in one go, setting the enable pins the one after the other.&lt;br /&gt;Somehow this file got mixed up, and it refused to function.&lt;/p&gt; &lt;p&gt;The second try was nice and clean, the idea was just to make two different instances of this liquid crystal object:&lt;/p&gt; &lt;p&gt;LiquidCrystal lcd(13, 12,      11,      9,8,7,6,5,4,3,2);//the upper two lines&lt;br /&gt;LiquidCrystal lcd1(13, 12,      10,      9,8,7,6,5,4,3,2);//the lower two lines&lt;/p&gt; &lt;p&gt;the last parameters are the ports, the difference is the enable port, coming from crystal pin: enable one goes to ARDUINO 10 and enable 2 to ARDUINO 11.&lt;br /&gt;This way the two halves, upper and under are seperatly steered. And this solved the problem!&lt;br /&gt;&lt;/p&gt; &lt;p&gt;#include&lt;/p&gt; &lt;liquidcrystal.h&gt; &lt;p&gt;//then setting up is easy: (actually already done)&lt;/p&gt; &lt;p&gt;void setup()&lt;br /&gt;{&lt;/p&gt; &lt;p&gt;lcd.print("hello there");&lt;br /&gt;lcd1.print("goodbye");&lt;br /&gt;}&lt;/p&gt; &lt;p&gt;the two lines are displayed in the two halves.&lt;/p&gt; &lt;p&gt;a test to see what is possible:&lt;/p&gt; &lt;p&gt;lcd.print("hello there and how are you0123456789012hello there and how are you");//first two lines filled.&lt;/p&gt; &lt;p&gt;displays:&lt;br /&gt;hello there and how are you&lt;br /&gt;hello there and how are you&lt;/p&gt; &lt;p&gt;we have 27 characters on the first line of upper, then several spaces not shown, then the next line starts.&lt;br /&gt;The first 27 are mentioned in the specs, but the gap is not what is described....the gap in memory addressing is 13 spaces, making it to 40 (decimal, which is not 64) to start the next line.&lt;br /&gt;&lt;a onblur="return true;try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Jq__kevBr8s/SkPh3QRNvcI/AAAAAAAABUc/3VLFd4buKNg/s1600-h/pins2.jpg" mce_href="http://4.bp.blogspot.com/_Jq__kevBr8s/SkPh3QRNvcI/AAAAAAAABUc/3VLFd4buKNg/s1600-h/pins2.jpg"&gt;&lt;img src="http://4.bp.blogspot.com/_Jq__kevBr8s/SkPh3QRNvcI/AAAAAAAABUc/3VLFd4buKNg/s320/pins2.jpg" style="cursor: pointer; width: 320px; height: 134px;" id="BLOGGER_PHOTO_ID_5351369121622506946" mce_src="http://4.bp.blogspot.com/_Jq__kevBr8s/SkPh3QRNvcI/AAAAAAAABUc/3VLFd4buKNg/s320/pins2.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;so here something is wrong in the data of this image.&lt;/p&gt; &lt;p&gt;The second line the same of course, because it is the same kind of object.&lt;/p&gt; &lt;p&gt;Possible mistakes (the ones we made :-) &lt;/p&gt;&lt;p&gt;As already mentioned: not buying the right slot for the wire connection.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;then not connecting the right wires, because of the amount of wires, this is easy....this shows by not producing the right characters, or a lot of spaces.&lt;br /&gt;the next mistake was to connect the pins in the wrong direction, that is , the other way around. Then the setting up wont be done properly and all kinds of problems occur, like not using the 4 lines etc.&lt;br /&gt;&lt;/p&gt; &lt;p&gt;Then there seem to be several LiquidCrystal.h files around in different ARDUINO versions.&lt;/p&gt; &lt;p&gt;The ones which worked (also on PC) were the files from the MAC 012 version of the ARDUINO.&lt;br /&gt;Testing on other .h files will be done, now that the wiring is ok.&lt;br /&gt;&lt;/p&gt; &lt;p&gt;Also sometimes the ARDUINO + display must be disconnected and connected again to show all lines. This feature is described: resetting the ARDUINO does not reset the display.&lt;/p&gt; &lt;p&gt;ok in the end, when it works, all is fine.&lt;/p&gt; &lt;p&gt;We learnt a lot on the library CPP files of the ARDUINO. So in fact how to write our own classes for the ARDUINO scripts in CPP.&lt;/p&gt;&lt;p&gt;And we learnt where we could buy the cheapest LCD of this kind! www.pollin.de, much other cheap fun around there, the only problem is that they don't accept credit cards or paypal.&lt;br /&gt;&lt;/p&gt; &lt;/liquidcrystal.h&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-7724401572564962214?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/7724401572564962214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=7724401572564962214' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7724401572564962214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7724401572564962214'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/06/liquid-crystal-display-wd-c2704m-and.html' title='Liquid crystal display WD-C2704M and the ARDUINO'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Jq__kevBr8s/SkRGlfLgt0I/AAAAAAAABUk/tr_ol71nkOY/s72-c/WINTEK.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-9195475369557897793</id><published>2009-05-28T22:38:00.001-07:00</published><updated>2009-05-28T22:38:24.662-07:00</updated><title type='text'>E paper workshop example files</title><content type='html'>&lt;h3 id="post-143"&gt;&lt;a href="http://blog.wdka.nl/crosslab-diy/2009/05/10/e-paper-workshop-example-files/" rel="bookmark" title="Permanent Link to E paper workshop example files"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/h3&gt;     &lt;small&gt;&lt;/small&gt;      &lt;div class="entry"&gt;      &lt;p&gt;The technical aspect: you ask for images, sounds, using a FLASH movie from keys from the keyboard. But then you decide to make a paper switch, which is just more fun than a dull key. So you need a device/program in between, there are lots of possibilities: hacking a keyboard, using a HID, or using the ARDUINO.&lt;/p&gt; &lt;p&gt;With a hacked keyboard (see other blog) all is easy, just use the FLASH movie.&lt;/p&gt; &lt;p&gt;With the HID, &lt;strong&gt;KeyWiz40 interface &lt;/strong&gt;(we have some at CROSSLAB) use a program between this thing and the&lt;strong&gt; FLASH &lt;/strong&gt;called&lt;strong&gt; USB OVERDRIVE &lt;/strong&gt;(Mac - Windows Joycur for instance)&lt;/p&gt; &lt;p&gt;With the ARDUINO use Serproxy, both MAC and Windows, but different files.&lt;/p&gt; &lt;p&gt;All is included in the download file below, (search USB OVERDRIVE here: &lt;a href="http://www.macupdate.com/info.php/id/7115"&gt;http://www.macupdate.com/info.php/id/7115&lt;/a&gt; )&lt;/p&gt; &lt;p&gt;So:&lt;/p&gt; &lt;p&gt;MAC and WINDOWS:&lt;/p&gt; &lt;p&gt;download this folder with the example files in FLASH:&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;a href="http://www.contrechoc.com/flash/e-paperFiles.zip"&gt;http://www.contrechoc.com/flash/e-paperFiles.zip&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;all can be tested with the normal keyboard too.&lt;/p&gt; &lt;p&gt;added is also the posibility to stream a video (flv format). Just add the video in the folder and ask for the name of the video (under button “6″)&lt;/p&gt; &lt;p&gt;then for the &lt;strong&gt;KeyWiz40 interface&lt;/strong&gt;:&lt;br /&gt;For “normal” e-paper using the keyboard interfaces from Crosslab we can use this example flash movie, with he folders sounds and images:&lt;/p&gt; &lt;p&gt;&lt;strong&gt;keyboard input examples.fla&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;we need for MAC: USB OVERDRIVE between the Whiz HID and FLASH, configure the buttons after choosing the “joystick” tab on the left.&lt;/p&gt; &lt;p&gt;for WINDOWS: for example JOYCUR (or other freeware), also configure some buttons&lt;/p&gt; &lt;p&gt;——————————————————————————————————–&lt;/p&gt; &lt;p&gt;&lt;strong&gt;ARDUINO&lt;/strong&gt; triggered e-paper,  with the same FLASH movie:&lt;/p&gt; &lt;p&gt;WINDOWS:&lt;/p&gt; &lt;p&gt;For e-paper triggered by input from the ARDUINO we start the SERPROXY (windows version) first (after having configured the right port in the serproxy.config, see the com port in arduino tools insert it (three times or so) and  the FLASH port must be 5331 please!)&lt;/p&gt; &lt;p&gt;then we need the ARDUINO script: arduinoAsKeyboard.pde in the ARDUINO.&lt;/p&gt; &lt;p&gt;then this flash movie: ARDUINO input examples.fla&lt;/p&gt; &lt;p&gt;MAC:&lt;/p&gt; &lt;p&gt;also use SERPROXY but the mac one found in the folder.&lt;/p&gt; &lt;p&gt;You have to configure the serproxy.config  file, using your serial connection, found in the arduino tools, or via the terminal using “ls /dev/cu.usb*” as explained on this page: &lt;a href="http://protolab.pbworks.com/TutorialFlashSetup"&gt;http://protolab.pbworks.com/TutorialFlashSetup &lt;/a&gt;&lt;/p&gt; &lt;p&gt;for the rest all the same, so upload the ARDUINO and run arduino script, and then run the FLASH movie.&lt;/p&gt; &lt;p&gt;/*******************************************************************************&lt;/p&gt; &lt;p&gt;For the real lover of e-paper: in the folder above is added a Processing example of reading the ports of the ARDUINO and triggering sounds, images, and text using Processing.The Arduino script used is the same as the last example: reading inputs from ports 12,11,10,9,8, this can be expanded. This eliminates the use of serproxy, or overdrive. But of course the Processing is not as flashy as FLASH!&lt;/p&gt;     &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-9195475369557897793?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/9195475369557897793/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=9195475369557897793' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/9195475369557897793'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/9195475369557897793'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/05/e-paper-workshop-example-files.html' title='E paper workshop example files'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-553654551725791389</id><published>2009-05-28T22:29:00.002-07:00</published><updated>2009-05-28T22:30:15.967-07:00</updated><title type='text'>Cheapo’s - or an Instable Multi Vibrator (!)</title><content type='html'>&lt;small&gt;&lt;/small&gt;      The ARDUINO is sometimes far too big, like a dinosaur in a cupboard. If you want to do a few switches or some simple sensor effects you can use an ATTINY13 for instance, lots of examples to be found on www.instructables.com. You have to program these insects, but the hex files are given too. So in fact it only resolves to loading the program another (clever) person made in assembler.&lt;div class="entry"&gt; &lt;p&gt;Another example of a useful IC is the 555 timer (also abundant on instructables), i came across some nice examples:&lt;/p&gt; &lt;p&gt;this is a switchlight, costing about 80 cents! &lt;a href="http://www.circuitsonline.net/circuits/view/13"&gt;http://www.circuitsonline.net/circuits/view/13 &lt;/a&gt;&lt;/p&gt; &lt;p&gt;and then  the instable multivibrator, or in normal language an ORGAN, &lt;img src="http://blog.wdka.nl/crosslab-diy/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley" /&gt; &lt;/p&gt; &lt;p&gt;&lt;a href="http://www.circuitsonline.net/circuits/view/130"&gt;http://www.circuitsonline.net/circuits/view/130 &lt;/a&gt;&lt;/p&gt; &lt;p&gt;very makeable, so i ordered some 555’s fast at conrad’s&lt;/p&gt; &lt;p&gt;The big advantage of these smaller IC’s is that they can be built/hidden into books, clothing, in toys without a problem, of course on itself they can do not too much, but with the help of the relais (see the blog before this one), they can steer processes as big as you want!&lt;/p&gt;     &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-553654551725791389?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/553654551725791389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=553654551725791389' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/553654551725791389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/553654551725791389'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/05/cheapos-or-instable-multi-vibrator.html' title='Cheapo’s - or an Instable Multi Vibrator (!)'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-690044043766636543</id><published>2009-05-28T22:29:00.001-07:00</published><updated>2009-05-28T22:29:32.699-07:00</updated><title type='text'>Cool materials, smart whatever, where do i buy it?</title><content type='html'>&lt;small&gt;&lt;/small&gt;      You know all kinds of interesting things are everywhere, but even with internet they are pretty difficult to find.&lt;div class="entry"&gt; &lt;p&gt;So here the result of a bit of experience, and indeed lots of houres searching.&lt;/p&gt; &lt;p&gt;Since I am on a tight budget, trying to make the most of it, i try to avoid “handling costs” or expensive ways of posting.&lt;/p&gt; &lt;p&gt;These links may change or disappear!&lt;/p&gt; &lt;p&gt;First of course: search in your neighbourhood: Harolds has graphite powder, thin metal wire to sew.&lt;/p&gt; &lt;p&gt;A real cool site is this one:&lt;/p&gt; &lt;p&gt;&lt;a href="http://mutr.co.uk/"&gt;http://mutr.co.uk/  —postal costs not indicated???&lt;br /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;thermo sensitive stuff, conductive stuff, EL, phone flasher, fancy switches, and even expensive things, like conductive cloth in small quantities so it remains affordable….&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.sparkfun.com/"&gt;http://www.sparkfun.com/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;for all around Arduino (and the lilypad ), very exciting&lt;br /&gt;(for me as a contrechoc.com and addict to five sided things:) ProtoBoard - Penta-shape, five angled board, don’t buy these, because these are mine :-)!&lt;/p&gt; &lt;p&gt;Sparkfun for conductive thread: yes expensive (everywhere) 20 euros…:-(&lt;/p&gt; &lt;p&gt;for all kinds of electronic equipments, resistors, relays, diodes, also EL sheet:&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.conrad.nl/"&gt;http://www.conrad.nl/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;this comes in handy because the delivery is relatively fast, for us in Holland.&lt;/p&gt; &lt;p&gt;For EL wire, in Rotterdam! So i can go there on bike and save me 6 euros posting&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.kitelight.nl/"&gt; http://www.kitelight.nl/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;For thermo-sensitive pigments, used for silkscreen:&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.zijdelings.eu/dupont.html"&gt;http://www.zijdelings.eu/dupont.html &lt;/a&gt;&lt;/p&gt; &lt;p&gt;ok here the direct link: &lt;a href="http://www.zijdelings.eu/overige-pigmenten.html" target="_blank"&gt;http://www.zijdelings.eu/overige-pigmenten.html&lt;/a&gt;&lt;/p&gt; &lt;p&gt;For Liquid tape, used with graphite powder from Harolds, to make conductive glue:&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.classicinternational.nl/textned/plastidip.htm"&gt;http://www.classicinternational.nl/textned/plastidip.htm &lt;/a&gt;&lt;/p&gt; &lt;p&gt;(minimum order 25 euro)&lt;/p&gt; &lt;p&gt;Ok, no, not at all: they don’t pay me for making this publicity!&lt;/p&gt;     &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-690044043766636543?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/690044043766636543/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=690044043766636543' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/690044043766636543'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/690044043766636543'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/05/cool-materials-smart-whatever-where-do.html' title='Cool materials, smart whatever, where do i buy it?'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-7904876950663786608</id><published>2009-05-28T22:28:00.003-07:00</published><updated>2010-03-19T02:44:04.184-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arduino'/><category scheme='http://www.blogger.com/atom/ns#' term='relais'/><category scheme='http://www.blogger.com/atom/ns#' term='relay'/><title type='text'>The other way around, also on three legs</title><content type='html'>&lt;small&gt;&lt;/small&gt;      A pushbutton for the ARDUINO needs three wires, this is for an input. The output, steering something from the ARDUINO has (no wonder) also three legs, it can be done by a transistor:&lt;div class="entry"&gt; &lt;p&gt;The middle wire of a transistor is the boss. When it has the proper signal (depending on type of the transistor , HIGH or LOW) it lets current pass through the outer two legs:&lt;/p&gt; &lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.contrechoc.com/blogPics//output.jpg" title="output.jpg"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://www.contrechoc.com/blogPics//output.jpg" title="output.jpg"&gt;&lt;img src="http://www.contrechoc.com/blogPics//output.jpg" alt="output.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;The port can have a 4.7K Ohm resistor, the effect only depends on the HIGH or LOW!&lt;/p&gt; &lt;p&gt;Cees Baarda provided with a transistor type: BC547C, others can be used too.&lt;/p&gt; &lt;p&gt;This way you can switch on or off: LED’s, speakers, etc. For more complex things to switch on, being on higher voltage than the ARDUINO, or if you want to save the power of the ARDUINO (using it stand alone, not on USB) and the thing to switch on has its own power, then you use a relay (relais).&lt;/p&gt; &lt;p&gt;A relay has two circuits, one to switch it (on low voltage) and the other (independant) with the real voltage, which can be much higher. The small voltage switches the high voltage circuit. Here is the picture from the datasheet from a relay:&lt;/p&gt; &lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.contrechoc.com/blogPics/relay.jpg" title="relay.jpg"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://www.contrechoc.com/blogPics/relay.jpg" title="relay.jpg"&gt;&lt;img src="http://www.contrechoc.com/blogPics//relay.jpg" alt="relay.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;You see legs 1 and 10 are the low voltage steering pins, and both sides have a high voltage switch between pins 7 and 8 (3 and 4).&lt;/p&gt; &lt;p&gt;So you can use the transistor to drive the relais, and the relais to switch on heavy duty things! Here the drawing of Cees Baarda, tested!&lt;/p&gt; &lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.contrechoc.com/blogPics//schema.jpg" title="schema.jpg"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://www.contrechoc.com/blogPics//schema.jpg" title="schema.jpg"&gt;&lt;img src="http://www.contrechoc.com/blogPics//schema.jpg" alt="schema.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;div style="text-align: center;"&gt;&lt;a href="http://www.contrechoc.com/blogPics//relais.jpg" title="relais.jpg"&gt;&lt;img src="http://www.contrechoc.com/blogPics/relais.jpg" alt="relais.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;From this relay the High Voltage of EL wire, or EL sheet can be switched of and on, regulated by the ARDUINO. The relais makes a sound (the magnetic jumper like a ticking “cloque de coucou” &lt;img src="http://blog.wdka.nl/crosslab-diy/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley" /&gt; &lt;/p&gt; &lt;p&gt;PS there is one more: the diode protecting the input port…..but it all very do it yourselfable.&lt;/p&gt; &lt;p&gt;PSS what does this cost? - where to get it?&lt;/p&gt; &lt;p&gt;relatively cheap: transistor BC547c conrad.nl  0,13 euro&lt;/p&gt; &lt;p&gt;resistors (koolfilmweerstand) conrad.nl  0.09 euro&lt;/p&gt; &lt;p&gt;relay (relais) conrad.nl 1.69 euro&lt;/p&gt; &lt;p&gt;diode  conrad.nl 0.04 euro&lt;/p&gt;     &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-7904876950663786608?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/7904876950663786608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=7904876950663786608' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7904876950663786608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7904876950663786608'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/05/other-way-around-also-on-three-legs.html' title='The other way around, also on three legs'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-49168214396613822</id><published>2009-05-28T22:28:00.001-07:00</published><updated>2010-03-19T02:45:32.454-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arduino'/><category scheme='http://www.blogger.com/atom/ns#' term='button'/><title type='text'>Even a button has three legs</title><content type='html'>&lt;small&gt;&lt;/small&gt;      Connecting a button is one of the easiest things to do. A light switch should transmit, or not transmit current, being on of off.&lt;div class="entry"&gt; &lt;p&gt;Although some reflection reveals that in reality it is not easy either: a window won’t stay open or shut without a hook, nor a door…&lt;/p&gt; &lt;p&gt;Receiving a signal from a button on an Arduino (Lilypad) is just a bit more complicated than the Boolean (TRUE - FALSE) character found in the laptop&lt;/p&gt; &lt;p&gt;A button on the ARDUINO (or comparable) is read in a digital input port registering  either a HIGH or a LOW (being either a connection to 5V or to the Ground GND). So a button has three wires! Two wires to 5V and GND respectively and one to the digital input port.&lt;/p&gt; &lt;p&gt;Also: the button needs a resistor (otherwise there might start running a current and you have a short circuit!). You have to make “the standard” state of a port either a HIGH or LOW, and the non standard, pushed, state where the button connects to the reverse but this last connection through the resistor (10K).&lt;/p&gt; &lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.contrechoc.com/blogPics/push.jpg" title="push.jpg"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://www.contrechoc.com/blogPics/push.jpg" title="push.jpg"&gt;&lt;img src="http://www.contrechoc.com/blogPics/push.jpg" alt="push.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;When you make connection only to the HIGH for example through the resistor, then the LOW state might become HIGH too, because it is not kept LOW. This gives erratic (artistic) behaviour! (Ever waked up at night because of an unsecured windowmaking lot’s of noise?)&lt;/p&gt; &lt;p&gt;See all this explained much more technically:&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.arduino.cc/en/Tutorial/Button"&gt;http://www.arduino.cc/en/Tutorial/Button &lt;/a&gt;&lt;/p&gt; &lt;p&gt;This is not at all difficult, but just a bit more complicated then you would think, seeing a light switch in a lamp.&lt;/p&gt; &lt;p&gt;Details:&lt;/p&gt; &lt;p&gt;in this link&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.lulu.com/items/volume_63/1108000/1108699/4/print/ARDUINO_NOTEBOOKv6.pdf"&gt; http://www.lulu.com/items/volume_63/1108000/1108699/4/print/ARDUINO_NOTEBOOKv6.pdf&lt;/a&gt;&lt;/p&gt; &lt;p&gt;i came across an important remark, apparently saving the trouble of putting the pullup resistors, because the input port is already protected:&lt;/p&gt; &lt;p&gt;“Arduino digital pins default to inputs, so they don’t need to be explicitly declared as inputs with pinMode(). Pins configured as INPUT are said to be in a high-impedance state.&lt;br /&gt;There are also convenient 20KΩ pullup resistors built into the Atmega chip that can be accessed from software. These built-in pullup resistors are accessed in the following manner:&lt;br /&gt;pinMode(pin, INPUT); // set ‘pin’ to input&lt;br /&gt;digitalWrite(pin, HIGH); // turn on pullup resistors&lt;br /&gt;Pullup resistors would normally be used for connecting inputs like switches. Notice in the above example it does not convert pin to an output, it is merely a method for activating the internal pull-ups.”&lt;/p&gt; &lt;p&gt;more interesting stuff on the pull-up: (apparently the above is partially copied from this source or the other way around:)&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.arduino.cc/en/Tutorial/DigitalPins"&gt;http://www.arduino.cc/en/Tutorial/DigitalPins &lt;/a&gt;&lt;/p&gt; &lt;p&gt;a very extended bunch of ARDUINO things:&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.freeduino.org/"&gt;http://www.freeduino.org/ &lt;/a&gt;&lt;/p&gt;     &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-49168214396613822?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/49168214396613822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=49168214396613822' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/49168214396613822'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/49168214396613822'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/05/even-button-has-three-legs.html' title='Even a button has three legs'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-1137985745348241132</id><published>2009-05-28T22:27:00.001-07:00</published><updated>2009-05-28T22:27:46.461-07:00</updated><title type='text'>Lilypad</title><content type='html'>&lt;small&gt;&lt;/small&gt;      The Lilypad is much more designed than the ARDUINO. The arduino itself is a working horse, a factory. All kinds of hidden extra possibilities, like we have seen in other posts on this blog, even more to come! The ARDUINO board is rectangular, functional. The Lilypad is round, and the pins are shaped like a flower. Also the habit of putting shields on top of the ARDUINO is not possible with the Lilypad. The microcontroller is a bit different, being a ATMAGE168V, smaller, and not replacable(so be careful!). Lilypad can run on a 3V coin battery.&lt;div class="entry"&gt; &lt;p&gt;The Lilypad was designed and developed by Leah Buechley and SparkFun Electronics. It can be used as a wearable much more comfortable than the ARDUINO, although, when using small scripts, either a “naked” ATMEGA168 can be used, or even a Tiny13. These IC’s without the boards can be hidden quite easily too.&lt;/p&gt; &lt;p&gt;But no using the Lilipad, you have to SHOW it!&lt;/p&gt; &lt;p&gt;Starting it up is different too. You can use the ARDUINO (without the ATMEGA168) to transfer scripts. See the &lt;a href="http://web.media.mit.edu/%7Eleah/LilyPad/01_computer_attach.html"&gt;http://web.media.mit.edu/~leah/LilyPad/01_computer_attach.html  &lt;/a&gt;The resetting of the Lilypad and the starting the transfer of the script is rather tricky! I saw my Lilypad flickering so I knew it was alive, otherwise… In XP it didnt work at all, On my OS side (of my MACBOOK) with apparently a different setup of the ARDUINO software (version 012) it works after a few tries. So first you get an error “out of sync” or “programmer not connected” the suddenly, the normal announcement of the script size (in the editor window of the ARDUINO software). So keep trying, resetting the Lilypad after hitting the transfer button varying a bit in seconds between these two actions.&lt;/p&gt; &lt;p&gt;My first real test was sewing the Lilypad on a cap, with a light resistor, when the light goes, (or somebody tries to steal my cap) a LED is fired up. Not very spectacular, but good as a starter. I didn’t try to hide the wiring!&lt;/p&gt; &lt;p&gt;Having to transfer these scripts (after testing the script on a normal ARDUINO), having to sew the Lilypad on the clothing, and thinking about how to hide, or show the wiring…this  becomes a complex job!&lt;/p&gt; &lt;p&gt;And be careful not to walk around showing the Lilypad in Airport areas, because people might think that you want to blast the place away and call the police (this has actually happenend, see the last MAKE magazine, and the consequences for the “really innocent”wearer were not pleasant!).&lt;/p&gt; &lt;p&gt;&lt;a href="http://blog.wdka.nl/crosslab-diy/files/2009/03/cap1.jpg" title="cap1.jpg"&gt;&lt;img src="http://blog.wdka.nl/crosslab-diy/files/2009/03/cap1.jpg" alt="cap1.jpg" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;A few links:Very much the Lilypad home: &lt;a href="http://www.cs.colorado.edu/%7Ebuechley/LilyPad/index.html"&gt;http://www.cs.colorado.edu/~buechley/LilyPad/index.html&lt;/a&gt;&lt;/p&gt; &lt;p&gt;This link to get arduino (in general) running in 15 minutes and…the help!:&lt;a href="http://www.ladyada.net/learn/arduino/help.html"&gt;http://www.ladyada.net/learn/arduino/help.html &lt;/a&gt;&lt;/p&gt; &lt;p&gt;lilypad doc:&lt;a href="http://arduino.cc/en/Guide/ArduinoLilyPad"&gt;http://arduino.cc/en/Guide/ArduinoLilyPad &lt;/a&gt;&lt;/p&gt; &lt;p&gt;a report of a workshop:link:&lt;a href="http://web.media.mit.edu/%7Eleah/publications/buechley_CHI_08.pdf"&gt;http://web.media.mit.edu/~leah/publications/buechley_CHI_08.pd&lt;/a&gt;f&lt;/p&gt;     &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-1137985745348241132?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/1137985745348241132/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=1137985745348241132' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/1137985745348241132'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/1137985745348241132'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/05/lilypad.html' title='Lilypad'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-6730906342171603431</id><published>2009-05-28T22:26:00.000-07:00</published><updated>2009-05-28T22:27:07.911-07:00</updated><title type='text'>Saving an ATMEGA 168</title><content type='html'>&lt;small&gt;&lt;/small&gt;      Why did I write this mail to Jeff?: (it is a long story…)&lt;div class="entry"&gt; &lt;p&gt;&lt;a href="http://mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/"&gt; http://mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;He Jeff, thx, for the artschool in Rotterdam Holland (WDKA) I thought I could save a bit of money buying ATMega’s instead of Lilypads and Arduino’s. I ran in the same fuses trouble I found in your blog (having more experience in Iphone programming :-). Just in this holiday week I decided I could try building your shield. I had to be careful (so being not at all artistic) and indeed I succeeded in…yes! making a tiny shortcut in between two near pins, of course the 5.5V and the GND of the ARDUINO. Invisible to the naked eye, there was a microscopic soldering error on my board between the not even “used” pins!&lt;br /&gt;USB protection saved me twice, but then amazingly my shield (a master copy of your shield) worked! I could recuperate the ATMEGA 168. (And the 9 others I had apparently meshed up!)&lt;/p&gt; &lt;p&gt;(See&lt;a href="http://blog.wdka.nl/crosslab-diy/2009/01/27/bootloading-the-arduino/" rel="bookmark" title="Permanent Link to Bootloading the Arduino"&gt; Bootloading the Arduino&lt;/a&gt; a blog of 27 januari.)&lt;/p&gt; &lt;p&gt;&lt;a href="http://blog.wdka.nl/crosslab-diy/files/2009/02/shield1.jpg" title="shield1.jpg"&gt;&lt;img src="http://blog.wdka.nl/crosslab-diy/files/2009/02/shield1.jpg" alt="shield1.jpg" /&gt;&lt;/a&gt;you see the Arduino is so rectangular, the lilypad is already nicer, but the single ATMEGA is even more small and “hideable”. Only, get this thing programmed! (Don’t forget to set the internal timer….&lt;a href="http://blog.wdka.nl/crosslab-diy/files/2009/02/shield1.jpg" title="shield1.jpg"&gt;) &lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://blog.wdka.nl/crosslab-diy/files/2009/02/shield2.jpg" title="shield2.jpg"&gt;&lt;img src="http://blog.wdka.nl/crosslab-diy/files/2009/02/shield2.jpg" alt="shield2.jpg" /&gt;&lt;/a&gt;What happened? I wanted to try “the naked ATMega168″. But I ran into trouble: the hex file to bootload the ATMEGA was nt the right one. First i started altering settings, I didn’t know about fuses, lockbits, so….in the end I foudn the right HEXfile, see former blog about this. But then apparemtly I already had bad settings for quite a few of the 10 ATMEGA’s.&lt;/p&gt; &lt;p&gt;So I started digging the internet and found the blog of Jeff. But well, it took me a few weeks to decide to build this shield (picture above). And after some trouble it did save 7 out of 10 ATMEGA’s. For the last three i am writing in the file of Jeff on the ARDUINO the eraseChip function, but that does not save me at the moment. Anyway, you don’t save time buying naked ATMEGA’s &lt;img src="http://blog.wdka.nl/crosslab-diy/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley" /&gt; But i have learnt a lot! Being able t make a shield is perfect and from the script of Jeff i learnt the possibility of setting ports 0-7 at once using the DATA.&lt;/p&gt; &lt;p&gt;And in the end the best reward is when it actually works!&lt;/p&gt; &lt;p&gt;I lost this link several times: the datasheet, the page to program HIGH VOLTAGE stuff is around 297:&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.atmel.com/dyn/resources/prod_documents/doc2545.pdf"&gt;http://www.atmel.com/dyn/resources/prod_documents/doc2545.pdf &lt;/a&gt;&lt;/p&gt;     &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-6730906342171603431?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/6730906342171603431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=6730906342171603431' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/6730906342171603431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/6730906342171603431'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/05/saving-atmega-168.html' title='Saving an ATMEGA 168'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-1579432324360932779</id><published>2009-05-28T22:25:00.000-07:00</published><updated>2010-03-19T02:49:39.187-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hacking keyboard'/><title type='text'>Hacking a keyboard</title><content type='html'>&lt;div class="post"&gt;     &lt;div class="entry"&gt;      &lt;p&gt;&lt;br /&gt;&lt;a href="http://www.contrechoc.com/blogPics//t3.jpg" title="t3.jpg"&gt;&lt;br /&gt;&lt;img src="http://www.contrechoc.com/blogPics//t3.jpg" alt="t3.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Looking for an easy way to get a lot of input possibilities attached to the computer, you could think of hacking a keyboard. That is taking it apart, finding the key matrix (a matrix is like a chessboard), and making the switches you need. It is all very well described here:&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.extremetech.com/article2/0,2845,2301149,00.asp"&gt; http://www.extremetech.com/article2/0,2845,2301149,00.asp&lt;/a&gt;&lt;/p&gt; &lt;p&gt;but also the writer warns that: there is no standard key matrix, so all types of keyboards have to be checked individually and that you have to be careful not to damage your computer, third you have the problem of ghosting, that is three buttons might awaken an extra ghost button.&lt;/p&gt; &lt;p&gt;Alternatives are available: prepared boards. A bit more expensiv, but first of all, you know it will work, second, you cannot damage you computer.&lt;/p&gt; &lt;p&gt;These hacks are listed here: &lt;a href="http://wiki.arcadecontrols.com/wiki/Keyboard_Encoders"&gt;http://wiki.arcadecontrols.com/wiki/Keyboard_Encoders&lt;/a&gt;&lt;/p&gt; &lt;p&gt;So I-PAC (USB): (31 euro’s + 4 TAX, feb 2009)&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.ultimarc.com/ipacve.html"&gt; http://www.ultimarc.com/ipacve.html&lt;/a&gt;&lt;/p&gt; &lt;p&gt;it comes with WinIPAC:&lt;/p&gt; &lt;p&gt;&lt;a href="http://ultimarc.com/download.html"&gt;http://ultimarc.com/download.html &lt;/a&gt;&lt;/p&gt; &lt;p&gt;KeyWiz40-Eco (26 dollar, TAX ? )&lt;/p&gt; &lt;p&gt;&lt;a href="http://groovygamegear.com/webstore/index.php?main_page=product_info&amp;amp;cPath=76_80&amp;amp;products_id=200"&gt;http://groovygamegear.com/webstore/index.php?main_page=product_info&amp;amp;cPath=76_80&amp;amp;products_id=200 &lt;/a&gt;&lt;/p&gt; &lt;p&gt;(no experience yet with these hack-boards! But they seem to be good…although noting is better then DIY, ok maybe sometimes it does not function then….:-)&lt;/p&gt; &lt;p&gt;Since the keyboard strokes are recorded and taken care of in FLASH (for instance) no need to reprogram the strokes anywhere else.&lt;/p&gt; &lt;p&gt;As an alternative to keyboard or the above mentioned keyboard chip, one could simple use the ARDUINO like the key matrix. Making ports input, and reading out the combinations, using the FLASH connection (or other) described elsewhere in this DIY blog.&lt;/p&gt; &lt;p&gt;first possibility: simple using the ports, setting all ports to input, use a 100 - 200 Ohm resistor and a switch.&lt;/p&gt; &lt;p&gt;second possibility:(using less ports, making combinations)&lt;/p&gt; &lt;p&gt;For instance: using 3 ports:0 = low, 1 = high, ports are connected to a single switch.&lt;/p&gt; &lt;p&gt;000 = a, (sending an a through the serial connections)&lt;/p&gt; &lt;p&gt;001 = b&lt;/p&gt; &lt;p&gt;010 = c&lt;/p&gt; &lt;p&gt;011 = d, etcetera&lt;/p&gt; &lt;p&gt;since the ARDUINO has 14 input ports (not counting the analog ports) we have a bewildering number of possibilities. (2 to the power of 14)&lt;/p&gt; &lt;p&gt;Third possibility, like the keyboard matrix:&lt;/p&gt; &lt;p&gt;use two rows of ports, look at the keyboard, 4 rows of keys, from bottom to top, use 4 porst for these rows, then take for instance 5 keys in each row, and connect these to five other ports, so each key is connected (with a switch) to 2 ports, the first determining which row to pick and the second which character in the row.&lt;/p&gt; &lt;p&gt;Then you see suddenly how many keys there are on a keyboard! Covering the whole keyboard with an ARDUINO, you have to divide the keyboard into regions, adding the number of rows, or take an extra switch to connect to each key…This will be a lot of work!&lt;/p&gt; &lt;p&gt;Maybe the above mentioned keyboard alternative is not so bad after all?&lt;/p&gt; &lt;p&gt;(Using the ARDUINO with FLASH, you need serproxy, and setting the serproxy config to the port used by the ARDUINO software - see other blog.)&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://www.contrechoc.com/blogPics/t2.jpg" title="t2.jpg"&gt;&lt;img src="http://www.contrechoc.com/blogPics/t2.jpg" alt="t2.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;So i started buying a flexible keyboard on the market. The purple one i didn’t sacrified, but a white one. Seeing through the layer reveals the wiring. On the side we have the chip. There are a lot of shortcut revealed! Trying out connections from the two side, sometimes the computer falls asleep, sometiems all is saved :-). So indeed be careful! I used male connectors to slip inside the matrix board. Here some pictures: (try connecting wires from the strip left under to the strip right under…&lt;/p&gt; &lt;p&gt;we bought this for CrossLab:&lt;/p&gt; &lt;p&gt;&lt;a href="http://groovygamegear.com/webstore/index.php?main_page=product_info&amp;amp;cPath=76_81&amp;amp;products_id=235"&gt;http://groovygamegear.com/webstore/index.php?main_page=product_info&amp;amp;cPath=76_81&amp;amp;products_id=235&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.contrechoc.com/blogPics/t4.jpg" title="t4.jpg"&gt;&lt;img src="http://www.contrechoc.com/blogPics/t4.jpg" alt="t4.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;     &lt;/div&gt;           &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-1579432324360932779?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/1579432324360932779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=1579432324360932779' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/1579432324360932779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/1579432324360932779'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/05/hacking-keyboard.html' title='Hacking a keyboard'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-7192651278239552328</id><published>2009-05-28T22:24:00.001-07:00</published><updated>2009-05-28T22:24:26.186-07:00</updated><title type='text'>Bootloading the Arduino</title><content type='html'>&lt;small&gt;&lt;/small&gt;      &lt;div class="entry"&gt;       &lt;p&gt;&lt;a href="http://blog.wdka.nl/crosslab-diy/files/2009/01/myarduino.jpg" title="myarduino.jpg"&gt;&lt;img src="http://blog.wdka.nl/crosslab-diy/files/2009/01/myarduino.jpg" alt="myarduino.jpg" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;The heart of the Arduino is the ATMEGA chip. The rest is only decoration! Decoration needed to get your program at the right spot, so useful decoration in the end. When you have an Arduino you can change programs all the time, but that means you always loose the last experiment. So buying the ATMEGA heart and storing your program on it, wiring the sensors and other elements definitively together you can save your stuff, without buying another Arduino.This saves you about 20 euro’s, but you have to do something 4 it!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blog.wdka.nl/crosslab-diy/files/2009/01/myarduino2.jpg" title="myarduino2.jpg"&gt;&lt;img src="http://blog.wdka.nl/crosslab-diy/files/2009/01/myarduino2.jpg" alt="myarduino2.jpg" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;The atmega168 can be bought for 4 .5 euro’s, with the 28 pin foot about 5.&lt;/p&gt; &lt;p&gt;This chip has to be bootloaded, so that the Arduino software can write to it. Crosslab has AVRISPmkll as an external programmer.&lt;/p&gt; &lt;p&gt;It took me a while to find out which hexfile to load. The Duemilanove needed the  ATmegaBOOT_168_ng.hex, the configs given on the page &lt;a href="http://www.arduino.cc/playground/Learning/Burn168"&gt;http://www.arduino.cc/playground/Learning/Burn168&lt;/a&gt;&lt;/p&gt; &lt;p&gt;configs, fuses, whatever — were ok, but the bootloader to be downloaded (ATmegaBOOT_168.hex) was not. (Although indicated on the Arduino playground page.)&lt;/p&gt; &lt;p&gt;Be careful with the fuses and never set the disable reset pin!!! See below or: &lt;a href="http://tinker.it/now/2007/02/24/the-tale-of-avrdude-atmega168-and-extended-bits-fuses/"&gt; http://tinker.it/now/2007/02/24/the-tale-of-avrdude-atmega168-and-extended-bits-fuses/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;The fact that it was not working could be checked when resetting: the LED 13 did not light up. Then transferring a script from the Arduino software gave an error.&lt;/p&gt; &lt;p&gt;With the right bootloader HEX file, the reset worked, and the transferring too.&lt;/p&gt; &lt;p&gt;Ok with this knowledge and experience, we can quickly make ready and program ATMEGA 168IC’s and use them for our projects. The chip can be sewn in clothing making smart textiles.&lt;/p&gt; &lt;p&gt;link adaboot: &lt;a href="http://wulfden.org/TheShoppe/freeduino/ADABOOT.shtml"&gt;http://wulfden.org/TheShoppe/freeduino/ADABOOT.shtml &lt;/a&gt;&lt;/p&gt; &lt;p&gt;One of the ten ATMEGA168 refused to get flashed, it was one of the first, and suffered probably a setting of the DISABLE RESET PIN. That is something to be avoided next time. The solution will cost a bit of extra effort and time: high voltage programming and making a shield: &lt;a href="http://mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/"&gt;http://mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/&lt;/a&gt;&lt;/p&gt; &lt;p&gt; &lt;img src="http://blog.wdka.nl/crosslab-diy/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley" /&gt; may be that Do-It-Yourself is for another day!&lt;/p&gt; &lt;p&gt;for the moment 9 out of 10 ATMEGA168’s are bootloaded…&lt;/p&gt; &lt;p&gt;The last ATMEGA has to what for high voltage programming (well high = 12V)&lt;/p&gt; &lt;p&gt;link for the AVR if you want to program in assembler (only then u r a real ‘man’)  &lt;img src="http://blog.wdka.nl/crosslab-diy/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley" /&gt; _ &lt;a href="http:///"&gt;http://www.howtofriends.com/avr/ &lt;/a&gt;&lt;/p&gt; &lt;p&gt;good ATMEGA info: &lt;a href="http://en.wikipedia.org/wiki/Atmel_AVR"&gt;http://en.wikipedia.org/wiki/Atmel_AVR &lt;/a&gt;&lt;/p&gt; &lt;p&gt;pinmapping: &lt;a href="http://www.arduino.cc/en/Hacking/PinMapping168"&gt;http://www.arduino.cc/en/Hacking/PinMapping168 &lt;/a&gt;&lt;/p&gt; &lt;p&gt;connecting the ATMEGA168 “naked”:  &lt;a href="http://itp.nyu.edu/physcomp/Tutorials/ArduinoBreadboard"&gt;http://itp.nyu.edu/physcomp/Tutorials/ArduinoBreadboard&lt;/a&gt;&lt;/p&gt; &lt;p&gt;or &lt;a href="http://blog.makezine.com/archive/2007/07/barebones_arduino_on_a_br.html"&gt;http://blog.makezine.com/archive/2007/07/barebones_arduino_on_a_br.html &lt;/a&gt;&lt;/p&gt; &lt;p&gt;later on I found the best link explaining about the ATMega168:&lt;/p&gt; &lt;p&gt;&lt;a href="https://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=93"&gt;https://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=93 &lt;/a&gt;&lt;/p&gt; &lt;p&gt;and all about oscillators:&lt;/p&gt; &lt;p&gt;&lt;a href="https://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=95"&gt;https://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=95 &lt;/a&gt;&lt;/p&gt;     &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-7192651278239552328?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/7192651278239552328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=7192651278239552328' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7192651278239552328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7192651278239552328'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/05/bootloading-arduino.html' title='Bootloading the Arduino'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-6834167082060585003</id><published>2009-05-05T11:34:00.000-07:00</published><updated>2009-06-25T14:05:04.558-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='I2CSensor'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>I2C on the NXT again! ( no: PCF8574A!)</title><content type='html'>We went back to the nxt for a moment.&lt;br /&gt;We tried the PCF8574, (actually mindsensors.com sent PCF8574A) I2C chip of mindsensors.com with the arduino, that worked fine on a breadboard with the wire.h class of the ARDUINO example.&lt;br /&gt;&lt;br /&gt;But the PCF8574A would not come alive with the NXT. We used the Anderson CPP lib, with bluetooth.&lt;br /&gt;But we discovered again what we already did actually know: you cannot write registers on the brick using bluetooth, so the address is not reached.&lt;br /&gt;(not very understandable at the moment, but we saw this too with the clock sensor....:-(((, it did cost a lot of time to figure this out.....why is the Anderson lib giving this possibility?? Did he succeed here?)&lt;br /&gt;&lt;br /&gt;So we tried the program on the brick. We had to reflash it, and we stumbled over my multiple USB connections (nxt not found......but without the hub, USB directly into the laptop, the NXT was at last found.)&lt;br /&gt;&lt;br /&gt;Then we had to figure out the i2c lejos class, we had this trouble with the former lib, (before the update) that it had the I2c addresses doubled, and indeed we found out from examples that some used 0x70 as the address.&lt;br /&gt;&lt;br /&gt;But the last update (nov 2008 0.7) just uses the (official)  address also used for the ARDUINO: 0x38.&lt;br /&gt;(So not the 0x40 mentioned in the mindsensors.com documentation.)&lt;br /&gt;&lt;br /&gt;Finally the LED's lighted up on the breedboard and on the mindsensors thing.&lt;br /&gt;&lt;br /&gt;The only problem left is this one: sensor.sendData(address, byte); but this means i can steer only 4 pins of the PCF8574A (1111 = F is one byte)....(?).....how to steer all 8? (Solution is simple see rest of blog)&lt;br /&gt;&lt;br /&gt;sensor.sendData(address, byte[], len); did not help......&lt;br /&gt;&lt;br /&gt;anyway we used this code to steer half the PCF8574A:&lt;br /&gt;&lt;br /&gt;import lejos.nxt.*;&lt;br /&gt;&lt;br /&gt;public class I2C {&lt;br /&gt;public static void main(String[] args) throws Exception {&lt;br /&gt;&lt;br /&gt;   I2CSensor  sensor =  new I2CSensor(SensorPort.S1) ;&lt;br /&gt;&lt;br /&gt;   int address = 0x38;&lt;br /&gt;    byte value = 0x0;&lt;br /&gt;    while (!Button.ESCAPE.isPressed())&lt;br /&gt;&lt;br /&gt;   {&lt;br /&gt;       sensor.setAddress(address);&lt;br /&gt;       LCD.drawInt(address,0,0);&lt;br /&gt;       value = 0x5;&lt;br /&gt;       sensor.sendData(address, value);&lt;br /&gt;       LCD.drawString("High",3,4);&lt;br /&gt;&lt;br /&gt;       Thread.sleep(500);&lt;br /&gt;&lt;br /&gt;       value = 0xA;&lt;br /&gt;       sensor.sendData(address, value);&lt;br /&gt;       LCD.drawString("low ",3,4);&lt;br /&gt;&lt;br /&gt;       Thread.sleep(500);&lt;br /&gt;       }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Then we searched for further solution of this last problem on the web and found this interesting application of the I2C sensor:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.extremenxt.com/keyboard.html"&gt;http://www.extremenxt.com/keyboard.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;What is this byte problem?&lt;br /&gt;Eclipse registered a mistake in: sensor.sendData(address, 0xFF); -- saying this 0xFF is no byte. The solution is simple: sensor.sendData(address, (byte)0xFF); -- and you can steer your eigth pins!&lt;br /&gt;&lt;br /&gt;ok the A0, A1, A2 pins can be used to attach rather a lot other PCF8574A chips to the same port. Because these pins make 8 base adresses possible, of chips steering 8 LEDS, makes 64 LEDS from one port!&lt;br /&gt;&lt;br /&gt;my idea is to let the ARDUINO and the NXT talk to each other by way of the I2C chips.....then you have a ARDUINO with bluetooth connection...well in principle.....&lt;br /&gt;&lt;br /&gt;it is nice to have some different controllers and consoles around, NXT ARDUINO, NDS (serial extension), IPHONE......it is very interesting to compare these systems. In the end the connections and the sensors are the same.....&lt;br /&gt;&lt;br /&gt;last tutorial lejos: &lt;a href="http://lejos.sourceforge.net/nxt/nxj/tutorial/index.htm"&gt;http://lejos.sourceforge.net/nxt/nxj/tutorial/index.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;found a good descritpion of the PCF8574: &lt;a href="http://www.i2cchip.com/pcf8574.html#PCF8574"&gt;http://www.i2cchip.com/pcf8574.html#PCF8574&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;at voti the PCF8574 costs 2,62 euro, &lt;a href="http://www.voti.nl/winkel/catalog.html"&gt;http://www.voti.nl/winkel/catalog.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;ever wanted to know all about i2c: &lt;a href="http://www.i2c-bus.org/"&gt;http://www.i2c-bus.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Last problem: when connecting the UltraSound distance sensor to the brick and steering the LEDS on the I2C "sensor" from the distance, refreshing all the time, we got a terrible effect of the LEDS between refresh all lighting up. So between indicating the distance we get a flash of all LEDS. This was still the case on a breadboard (without the mindsensor.com print). Not resolved.&lt;br /&gt;&lt;br /&gt;the ARDUINO script can be found here: &lt;a href="http://www.contrechoc.com/flash/arduino-i2c.txt"&gt;http://www.contrechoc.com/flash/arduino-i2c.txt&lt;/a&gt;&lt;br /&gt;the JAVA script (made in eclipse) can be found here: &lt;a href="http://www.contrechoc.com/flash/lejos-i2c.txt"&gt;http://www.contrechoc.com/flash/lejos-i2c.txt&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-6834167082060585003?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/6834167082060585003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=6834167082060585003' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/6834167082060585003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/6834167082060585003'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/05/i2c-on-nxt-again.html' title='I2C on the NXT again! ( no: PCF8574A!)'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-2287535610472853288</id><published>2009-02-11T08:51:00.000-08:00</published><updated>2009-02-11T08:55:37.955-08:00</updated><title type='text'>RFID ARDUINO SL performance on “Open dag”</title><content type='html'>All about having the right connections, like in real life:&lt;br /&gt;&lt;br /&gt;&lt;div class="post" id="post-39"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Jq__kevBr8s/SZMCcJ_eWsI/AAAAAAAABQ4/-TEE4isFi2Y/s1600-h/rfid.jpg"&gt;&lt;img style="cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_Jq__kevBr8s/SZMCcJ_eWsI/AAAAAAAABQ4/-TEE4isFi2Y/s320/rfid.jpg" alt="" id="BLOGGER_PHOTO_ID_5301583869086948034" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div class="entry"&gt; &lt;p&gt;See the tag hidden under the robot’s foot, the reader was hidden under the table. The walking robot triggered the RFID reader, wich was connected to a FLASH movie.&lt;/p&gt; &lt;p&gt;Then the ARDUINO was triggered by this FLASH movie. Sound was played on a speaker attached to the ARDUINO. The FLASH movie also changed a setting in an external database. This database is frequently checked by an object in Second Life called RFID Poltergeist. When this object sensed the changed setting, a wheelchair was rezzed in mid air. Since this wheelchair was made physical, it crashed down on the Poltergeist!&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Jq__kevBr8s/SZMCcKsQ1gI/AAAAAAAABRA/fkBhK1e4fLs/s1600-h/poltergeist.jpg"&gt;&lt;img style="cursor: pointer; width: 320px; height: 195px;" src="http://2.bp.blogspot.com/_Jq__kevBr8s/SZMCcKsQ1gI/AAAAAAAABRA/fkBhK1e4fLs/s320/poltergeist.jpg" alt="" id="BLOGGER_PHOTO_ID_5301583869274805762" border="0" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;See the pile of wheelchairs, all temporary of course, one should keep the world tidy.&lt;/p&gt;&lt;p&gt;A teacher told me this was all too funny. ICT is not funny at all according to him. I quite agree. But i cannot help it. All i do becomes funny, sorry.&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;   &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-2287535610472853288?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/2287535610472853288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=2287535610472853288' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2287535610472853288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2287535610472853288'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/02/rfid-arduino-sl-performance-on-open-dag.html' title='RFID ARDUINO SL performance on “Open dag”'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Jq__kevBr8s/SZMCcJ_eWsI/AAAAAAAABQ4/-TEE4isFi2Y/s72-c/rfid.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-1078247721539140200</id><published>2009-02-08T00:06:00.000-08:00</published><updated>2009-02-08T00:42:46.425-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wii remote'/><category scheme='http://www.blogger.com/atom/ns#' term='FLOCS'/><category scheme='http://www.blogger.com/atom/ns#' term='GLOVEPIE'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><category scheme='http://www.blogger.com/atom/ns#' term='wiiflash'/><title type='text'>FLOSC GLOVEPIE FLASH</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;Working on a MACBOOK the "wiiflash server" did not see my connected wii remote. It told me no wii remotes were connected.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;(Not on the XP side, neither on the OS side)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;(Never buy a MacBook: the double boot is ok, but all kind of problems with 3D programs, like Second Life BLENDER, and now also wiiflash, the Xcode is ok though, nice making a game for the Iphone, see other blogs)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Working on the XP side:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;BlueSoleil only caused other problems.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;So i relied on the simple bluetooth window provided by XP for connecting the wii remote.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Then i remembered the FLOSC, i searched the internet and found some vague references to this alternative to the wiiflash server.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;After a bit of experimenting i found out what to combine and how:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;1. Connect the wiiremote&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;2. start up GlovePie with this script (example script to connect and read a few values, change to what you need)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;OSC.port = 5000 // referring to OSC port in FLOSC ... OSC can be changed, it is just a variable name&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;OSC.ip = "localhost"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;OSC.broadcast = true&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;OSC.wii.x = Wiimote.gx&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;OSC.wii.y = Wiimote.gy&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;OSC.wii.z = Wiimote.gx&lt;/span&gt;&lt;br /&gt;&lt;a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Jq__kevBr8s/SY6WSKh-nhI/AAAAAAAABQg/Kwric3I9wKA/s1600-h/flosc.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px; height: 150px;" src="http://3.bp.blogspot.com/_Jq__kevBr8s/SY6WSKh-nhI/AAAAAAAABQg/Kwric3I9wKA/s320/flosc.jpg" alt="" id="BLOGGER_PHOTO_ID_5300339050270334482" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;OSC.roll =   RemoveUnits(Wiimote.Roll)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;OSC.pitch =   RemoveUnits(Wiimote.Pitch)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;3. start FLOSC:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;portnumbers from GLOVEPIE and FLASH&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Jq__kevBr8s/SY6WSHelqHI/AAAAAAAABQo/IzrZ4q2wAWo/s1600-h/Image2.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 158px;" src="http://2.bp.blogspot.com/_Jq__kevBr8s/SY6WSHelqHI/AAAAAAAABQo/IzrZ4q2wAWo/s320/Image2.jpg" alt="" id="BLOGGER_PHOTO_ID_5300339049450809458" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;4. example script in FLASH with a XMLsocket connection reading the XML input coming from FLOSC:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;import flash.events.*;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;import flash.net.XMLSocket;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;var hostName:String = "127.0.0.1";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;var port:uint = 1250; // referring to flash port in FLOSC&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;var socket:XMLSocket;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;socket = new XMLSocket();&lt;br /&gt;socket.connect(hostName, port);&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;socket.addEventListener(DataEvent.DATA, dataHandler);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;function dataHandler(event:DataEvent):void {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;var xmlData   = new XML();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;xmlData.ignoreWhite=true;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;xmlData = XML(event.data);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         /* comment example&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         ADDRESS = attribute&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         MESSAGE = descendant&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         incoming: (picture, because XML data are not visible on this page :-)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Jq__kevBr8s/SY6Y_02G9VI/AAAAAAAABQw/uWY8Vo2F5c0/s1600-h/Image2.jpg"&gt;&lt;img style="cursor: pointer; width: 320px; height: 84px;" src="http://2.bp.blogspot.com/_Jq__kevBr8s/SY6Y_02G9VI/AAAAAAAABQw/uWY8Vo2F5c0/s320/Image2.jpg" alt="" id="BLOGGER_PHOTO_ID_5300342033746425170" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;oscpacket style="font-family: arial;" address="127.0.0.1" port="1146" time="0"&gt;&lt;oscpacket address="127.0.0.1" port="1146" time="0"&gt;&lt;message name="/wii/x"&gt;&lt;argument type="f" value="0.1"&gt;&lt;/argument&gt;&lt;/message&gt;&lt;message name="/wii/x"&gt;&lt;/message&gt;&lt;br /&gt;       gives: (with trace line below)&lt;br /&gt; &lt;br /&gt;       /wii/x&lt;br /&gt;       f -3.9451861&lt;br /&gt;       */&lt;br /&gt; &lt;br /&gt;trace( xmlData.descendants("MESSAGE").attribute("NAME")   );&lt;br /&gt;trace( xmlData.descendants("ARGUMENT").attribute("TYPE") + " " +  xmlData.descendants("ARGUMENT").attribute("VALUE")    );  &lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;6. make use of the data in fancy flash application!&lt;br /&gt;&lt;br /&gt;for instance: asking for the x value:&lt;br /&gt;&lt;br /&gt;            if ( String(xmlData.descendants("MESSAGE").attribute("NAME")) == "/wii/x")&lt;br /&gt;            giveNumberX.text =String(xmlData.descendants("ARGUMENT").attribute("VALUE"));&lt;br /&gt;&lt;br /&gt;putting the value in the field &lt;/oscpacket&gt;&lt;/oscpacket&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;giveNumberX.&lt;br /&gt;&lt;br /&gt;Have fun!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;oscpacket style="font-family: arial;" address="127.0.0.1" port="1146" time="0"&gt;&lt;oscpacket address="127.0.0.1" port="1146" time="0"&gt;         &lt;br /&gt;       &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/oscpacket&gt;&lt;/oscpacket&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-1078247721539140200?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/1078247721539140200/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=1078247721539140200' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/1078247721539140200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/1078247721539140200'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/02/flosc-glovepie-flash.html' title='FLOSC GLOVEPIE FLASH'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Jq__kevBr8s/SY6WSKh-nhI/AAAAAAAABQg/Kwric3I9wKA/s72-c/flosc.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-5984215420525033315</id><published>2009-01-27T12:58:00.000-08:00</published><updated>2009-01-27T13:01:39.375-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arduino'/><category scheme='http://www.blogger.com/atom/ns#' term='bootloader'/><title type='text'>ARDUINO for 5 euro (?)</title><content type='html'>&lt;p&gt;The atmega168 can be bought for 4 .5 euro's, with the 28 pin foot about 5.&lt;/p&gt; &lt;p&gt;This chip has to be bootloaded, so that the Arduino software can write to it.You need for instance  AVRISPmkll as an external programmer.&lt;/p&gt; &lt;p&gt;It took me a while to find out which hexfile to load. The Duemilanove needed the  ATmegaBOOT_168_ng.hex, the configs given on the page &lt;a href="http://www.arduino.cc/playground/Learning/Burn168" mce_href="http://www.arduino.cc/playground/Learning/Burn168"&gt;http://www.arduino.cc/playground/Learning/Burn168&lt;/a&gt;&lt;/p&gt; &lt;p&gt;configs, fuses, whatever -- were ok, but the bootloader to be downloaded (ATmegaBOOT_168.hex) was not. (Although indicated on the Arduino playground page.)&lt;br /&gt;&lt;/p&gt; &lt;p&gt;The fact it was not working could be seen when resetting: the LED 13 did not light up. Then transferring a script from the Arduino software gave an error.&lt;/p&gt; &lt;p&gt;With the right bootloader HEX file, the reset worked, and the transferring too.&lt;/p&gt; &lt;p&gt;Ok with this knowledge and experience, we can quickly make ready and program ATMEGA 168IC's and use them for our projects. The chip can be sewn in clothing making smart textiles.&lt;/p&gt; &lt;p&gt;link adaboot: &lt;a href="http://wulfden.org/TheShoppe/freeduino/ADABOOT.shtml" mce_href="http://wulfden.org/TheShoppe/freeduino/ADABOOT.shtml"&gt;http://wulfden.org/TheShoppe/freeduino/ADABOOT.shtml &lt;/a&gt;&lt;/p&gt;&lt;p&gt; One of the ten ATMEGA168 refused to get flashed, it was one of the first, and suffered probably a setting of the DIABLE RESET PIN. That is something to be avoided next time. The solution will cost a bit of effort and time: high voltage programming and making a shield:&lt;a mce_href="http://mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/" href="http://mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/"&gt;http://mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;:-) may be that Do It Yourself is for another day!&lt;/p&gt;for the moment 9 out of 10 ATMEGA168's are bootloaded...&lt;br /&gt;&lt;br /&gt;(from my DIY blog on the WDKA)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-5984215420525033315?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/5984215420525033315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=5984215420525033315' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/5984215420525033315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/5984215420525033315'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/01/arduino-for-5-euro.html' title='ARDUINO for 5 euro (?)'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-6244620501506673910</id><published>2009-01-20T22:54:00.000-08:00</published><updated>2009-01-21T00:11:04.786-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arduino'/><category scheme='http://www.blogger.com/atom/ns#' term='serproxy'/><category scheme='http://www.blogger.com/atom/ns#' term='rfid'/><category scheme='http://www.blogger.com/atom/ns#' term='phidget reader'/><title type='text'>Communicating reading writing Arduino FLASH</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;Using TinkerProxy you can receive data from the Arduino doing something in FLASH.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;(Using the socket server)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;But you cannot send data back from FLASH to the Arduino&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;This can be done with Serproxy, but you have to change the config file to the right port:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;(several links explaining for instance: &lt;/span&gt;&lt;a style="font-family: arial;" href="http://www.tinker.it/en/Teaching/Flash"&gt;http://www.tinker.it/en/Teaching/Flash&lt;/a&gt;&lt;span style="font-family: arial;"&gt; )&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;when configured the Serproxy allows reading and writing.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;so this Arduino script sends 0 and 100 alternately and listens for a value.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;When this value comes it puts this value on ledport 9.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;/* read and write script (combining two arduino sketchbook scripts&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt; *&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt; * blink without delay and send the values to a socket&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt; * listen for data sent to the arduino and react on a ledPin 9&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt; * from FLASH an int between 0-255 is sent&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt; *&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt; */&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;int ledPin13 = 13;                // LED connected to digital pin 13&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;int ledPin9 = 9;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;int value = LOW;                // previous value of the LED&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;long previousMillis = 0;        // will store last time LED was updated&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;long interval = 1000;           // interval at which to blink (milliseconds)&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;void setup()&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;{&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;  pinMode(ledPin13, OUTPUT);      // sets the digital pin as output&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;  &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    // begin the serial communication&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;  Serial.begin(9600);&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;  pinMode(ledPin9, OUTPUT);&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;  &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;}&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;void loop()&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;{&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;  if (millis() - previousMillis &gt; interval) {&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    previousMillis = millis();   // remember the last time we blinked the LED&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    // if the LED is off turn it on and vice-versa.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    if (value == LOW)&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    {&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;      value = HIGH;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;      Serial.println("100");&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    }&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    else&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    {&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;      value = LOW;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;       Serial.println("0");&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    }&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    digitalWrite(ledPin13, value);&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;   &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;  }&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;  &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;   byte val;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;  &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;  // check if data has been sent from the computer&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;  if (Serial.available()) {&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    // read the most recent byte (which will be from 0 to 255)&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    val = Serial.read();&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    // set the brightness of the LED&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    analogWrite(ledPin9, val);&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;  }&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;}&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;Then the flash script is opening a socket port: (using a simple modified script found on the arduino playground)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 153); font-family: arial;font-size:85%;" &gt;function openArduinoSocket()&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 153); font-family: arial;font-size:85%;" &gt;{&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 153); font-family: arial;font-size:85%;" &gt;   &lt;br /&gt;//Create a socket connection to serproxy&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 153); font-family: arial;font-size:85%;" &gt;   &lt;br /&gt;arduinoSocket = new Socket("localhost",5331);&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 153); font-family: arial;font-size:85%;" &gt;    arduinoSocket.addEventListener(Event.CLOSE, closeHandler);&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 153); font-family: arial;font-size:85%;" &gt;    arduinoSocket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 153); font-family: arial;font-size:85%;" &gt;&lt;br /&gt;}&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;reading the data from the port:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;function socketDataHandler(event:ProgressEvent):void&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;{&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    // Get the value from the potentiometer (0-1024) and&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt; // normalize it to (0-2) range for the fire component.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;   &lt;br /&gt;var nb : uint = arduinoSocket.bytesAvailable;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;    var bytes:ByteArray = new ByteArray();&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;   &lt;br /&gt;var input:String = String(arduinoSocket.readUTFBytes(arduinoSocket.bytesAvailable));&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;     &lt;/span&gt; &lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;   &lt;br /&gt;var ST: String ="";&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255); font-family: arial;font-size:85%;" &gt;for (var i=0; i&lt;&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;    {&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;if ( !(input.charCodeAt(i)==10 || input.charCodeAt(i)==13))&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;       &lt;br /&gt;ST += input.charAt(i);&lt;/span&gt;  &lt;span style="color: rgb(51, 51, 255);"&gt;    }&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;//we have to make a number from the chars or string getting in.....:-(&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;//right order????&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;var STNumber : Number = Number(ST.charAt(0))*100  + Number(ST.charAt(1))*10 + Number(ST.charAt(2))*1;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;giveNumber.text =  String(STNumber) ;&lt;br /&gt;//writing it in a text field&lt;/span&gt;  &lt;span style="color: rgb(51, 51, 255);"&gt;    //from arduino script coming out either 0 or 100&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;   &lt;br /&gt;if(  STNumber &gt; 25   )&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;    {&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;giveResult.text = "high";&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;   &lt;br /&gt;}&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;   &lt;br /&gt;else&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;    {&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;       &lt;br /&gt;giveResult.text = "low";&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;    }&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;then comes the sending part: (just a timer which brightens up a led on the arduino)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;var minuteTimer:Timer = new Timer(500);     &lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;minuteTimer.addEventListener(TimerEvent.TIMER, onTick);&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;minuteTimer.start();&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;      &lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;var counter : int= 0;&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;      &lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;br /&gt;function onTick(event:TimerEvent):void &lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;        {&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;           &lt;br /&gt;counter +=10;&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;           arduinoSocket.writeInt(counter % 250 ); //not higher then 250&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;            arduinoSocket.flush();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;ok next step is to take a  rfid reader and make the rfid reader when seeing the right tag, sending a signal to the arduino, we need another USB port reader for this Phidget21 (we are using the phidget reader) ...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;The Flash movie in connection with the rfid reader gave three mp3 sounds on three different tags. Then the functions of the Arduino socket were installed, the Arduino script a bit changed, adding a speaker to the Arduino.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;The tags gave sounds in the FLASH movie, and at the same time the Arduino produced a tone on the speaker....an image (yeah, it is a shame you cannot here the sounds :-)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Jq__kevBr8s/SXbXDNc6shI/AAAAAAAABQE/-ptkpWrBGu0/s1600-h/rfidArduino.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 245px;" src="http://3.bp.blogspot.com/_Jq__kevBr8s/SXbXDNc6shI/AAAAAAAABQE/-ptkpWrBGu0/s320/rfidArduino.jpg" alt="" id="BLOGGER_PHOTO_ID_5293654862171124242" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/a&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;The Arduino can be seen, with the speaker, and the rfid reader with the tags, what cannot be seen are the Phidget21 and the serproxy, and the flash movie triggered by the rfid reader and sending data to the arduino...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-6244620501506673910?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/6244620501506673910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=6244620501506673910' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/6244620501506673910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/6244620501506673910'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/01/communicating-reading-writing-arduino.html' title='Communicating reading writing Arduino FLASH'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Jq__kevBr8s/SXbXDNc6shI/AAAAAAAABQE/-ptkpWrBGu0/s72-c/rfidArduino.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-5204047082578220747</id><published>2009-01-11T05:51:00.000-08:00</published><updated>2009-01-11T06:14:25.406-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arduino'/><category scheme='http://www.blogger.com/atom/ns#' term='laserharp'/><category scheme='http://www.blogger.com/atom/ns#' term='sound'/><title type='text'>Arduino and Sound</title><content type='html'>&lt;span style="font-family: arial;"&gt;What about making the Arduino and a simple loudspeaker produce a tone?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;Quite simple:&lt;/span&gt;&lt;br /&gt;&lt;a style="font-family: arial;" href="http://www.uchobby.com/index.php/2007/11/14/arduino-sound-part-2-hello-world/"&gt;http://www.uchobby.com/index.php/2007/11/14/arduino-sound-part-2-hello-world/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;i quickly made a small change in the script to get a lightsensor alter the pitch:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;#define SOUNDOUT_PIN 13&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;#define potPin 0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;int val = 0;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;void setup(void){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;//Set the sound out pin to output mode&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;pinMode(SOUNDOUT_PIN,OUTPUT);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;//output the serial port to check the values&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt; Serial.begin(9600);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;void loop(void){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;//Generate sound by toggling the I/O pin High and Low&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;//Generate a 1KHz tone. set the pin high for 500uS then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;//low for 500uS to make the period 1ms or 1KHz.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;//Set the pin high and delay for 1/2 a cycle of 1KHz, 500uS.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;digitalWrite(SOUNDOUT_PIN,HIGH);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;delayMicroseconds(val);&lt;/span&gt;//val instead of the fixed 500&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;//Set the pin low and delay for 1/2 a cycle of 1KHz, 500uS.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;digitalWrite(SOUNDOUT_PIN,LOW);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;delayMicroseconds(val);&lt;/span&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;&lt;/span&gt;//val instead of the fixed 500&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt; val = analogRead(potPin);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt; Serial.print(val, DEC); //reading a lightsensor from a second volt divider, here checking values&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;  Serial.print("\n");//to get an idea of what is read in and make a calibration of the pitch&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial; color: rgb(51, 51, 255);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;Now I had a tone from a speaker, steered from a lightsensor, which could be replaced by other sensors. The volume can be regulated by a potentiometer in the first volt divider.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;Then I used a small laser (the one to hang pictures really horizontally) and really could make the pitch jump, when the laser was on the lightsensor.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;This could be the start of a low budget laserharp. Just make the tone only when a certain level of light is detected.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;Here are the simple connecting drawings, the values of resisters and lightsensors must be experimentally tried out, for me it just worked with a 1 K resistor, lying around.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a style="font-family: arial;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Jq__kevBr8s/SWn-PxBWxlI/AAAAAAAABN4/-kroCWoNktc/s1600-h/arduino-sound.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 193px;" src="http://1.bp.blogspot.com/_Jq__kevBr8s/SWn-PxBWxlI/AAAAAAAABN4/-kroCWoNktc/s320/arduino-sound.jpg" alt="" id="BLOGGER_PHOTO_ID_5290038784133875282" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-5204047082578220747?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/5204047082578220747/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=5204047082578220747' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/5204047082578220747'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/5204047082578220747'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/01/arduino-and-sound.html' title='Arduino and Sound'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Jq__kevBr8s/SWn-PxBWxlI/AAAAAAAABN4/-kroCWoNktc/s72-c/arduino-sound.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-7591685988989664118</id><published>2009-01-09T08:11:00.000-08:00</published><updated>2009-01-09T08:39:57.590-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arduino'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><category scheme='http://www.blogger.com/atom/ns#' term='tinkerproxy'/><title type='text'>Arduino and Flash Second Attempt</title><content type='html'>First in the Arduino program we created a simple program reading a light sensor (combined with a resistor).&lt;br /&gt;&lt;br /&gt;Using this script:&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;//Arduino script&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;/*&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;int potPin = 0;    // select the input pin for the potentiometer&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;int val = 0;       // variable to store the value coming from the sensor&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;void setup() {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  Serial.begin(9600);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;void loop() {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  val = analogRead(potPin);    // read the value from the sensor&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Serial.print(val,DEC);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Serial.print("\n");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Using tinkerproxy this time, configuring the COM-port&lt;br /&gt;&lt;br /&gt;Then starting Flash, with a socket:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;arduinoSocket = new Socket("localhost",5331);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;arduinoSocket.addEventListener(Event.CLOSE, closeHandler);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;arduinoSocket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;then reading the incoming bytes we have to make from this string a number:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;var nb : uint = arduinoSocket.bytesAvailable;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;var bytes:ByteArray = new ByteArray();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;var input:String = String(arduinoSocket.readUTFBytes(arduinoSocket.bytesAvailable));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;     &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    var ST: String ="";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    for (var i=0; i&lt;&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;        if ( !(input.charCodeAt(i)==10 || input.charCodeAt(i)==13))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;        ST += input.charAt(i);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;var STNumber : Number = Number(ST.charAt(0))*100  + Number(ST.charAt(1))*10 + Number(ST.charAt(2))*1;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;//we have to check if the order for one-decimal-hundred's is right??&lt;br /&gt;&lt;br /&gt;ok this gave us a start.&lt;br /&gt;but the values read were rather erratic&lt;br /&gt;&lt;br /&gt;so we changed the script on the Arduino so that either a 0 or a 100 is sent:&lt;br /&gt;&lt;br /&gt;&lt;img src="file:///C:/DOCUME%7E1/FIVEMA%7E1/LOCALS%7E1/Temp/moz-screenshot.jpg" alt="" /&gt;&lt;img src="file:///C:/DOCUME%7E1/FIVEMA%7E1/LOCALS%7E1/Temp/moz-screenshot-1.jpg" alt="" /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;//Arduino script&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;/*&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;int potPin = 0;    // select the input pin for the potentiometer&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;int ledPin = 13;   // select the pin for the LED&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;int val = 0;       // variable to store the value coming from the sensor&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;void setup() {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  Serial.begin(9600);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;void loop() {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  val = analogRead(potPin);    // read the value from the sensor&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  if (val &gt; 100)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Serial.print(0,DEC);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Serial.print(100,DEC);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Serial.print("\n");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;then the reading becomes:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;//from arduino script coming out either 0 or 100&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    if(  STNumber &gt; 25   )&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;        giveResult.text = "high";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;        giveResult.text = "low";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;        if (  myVideo == null )&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;         myVideo   = new  VideoExample(  videoPlayer );//loading video in videoPlayer Sprite&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;so this starts a video, in a separate class (from a FLASH example)&lt;br /&gt;&lt;br /&gt;but we dont want to start this video all the time, :-)&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;var now2:Date = new Date();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    var timeDifference: Number = now2.getTime() - timeTag1;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    //here give length in time of video : this blocks reading&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    var lengthOfVideoInSeconds = 15;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    if ( timeDifference /1000 &gt; lengthOfVideoInSeconds )&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;        myVideo = null;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;        timeTag1 = now2.getTime();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This procedure can be altered, and should be optimized, but it worked.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-7591685988989664118?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/7591685988989664118/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=7591685988989664118' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7591685988989664118'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7591685988989664118'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2009/01/arduino-and-flash-second-attempt.html' title='Arduino and Flash Second Attempt'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-1913796514119414244</id><published>2008-12-20T01:13:00.000-08:00</published><updated>2008-12-20T01:20:42.876-08:00</updated><title type='text'>Arduino and Flash</title><content type='html'>The Arduino can be made to cooperate with FLASH CS3 (and other languages).&lt;br /&gt;A prog is put on the Arduino and running a XML socket in FLASH and a serverproxy we could get the serial port doing the connection.&lt;br /&gt;The glue lib posed some problems, not really working with the firmata ???&lt;br /&gt;In the end the example from the sketchbook called SimpleAnalogFirmata gave readings from an analog port and these readings were dispaled in the FLASH outputusing the SimpleIO from the glue library.&lt;br /&gt;&lt;br /&gt;It seems CS3 poses more problems than CS2.&lt;br /&gt;The code on this page, which must have worked then, didn't really work with me, it gave output, but the values were kind of rubbish: &lt;a href="http://aralbalkan.com/1243"&gt;http://aralbalkan.com/1243&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-1913796514119414244?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/1913796514119414244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=1913796514119414244' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/1913796514119414244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/1913796514119414244'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/12/arduino-and-flash.html' title='Arduino and Flash'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-8591040500693783238</id><published>2008-12-20T01:00:00.000-08:00</published><updated>2009-03-21T23:43:10.667-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arduino'/><category scheme='http://www.blogger.com/atom/ns#' term='PCF8574'/><category scheme='http://www.blogger.com/atom/ns#' term='I2CSensor'/><category scheme='http://www.blogger.com/atom/ns#' term='PCF8574A'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>NXT Arduino and I2C</title><content type='html'>Having ordered the I2C sensorkits from mindsensors.com we quickly soldered the components to the bord. But, it did not work. Since we had no idea how to analyze the situation, nor any idea how the real I2C sensor worked we left it where it was...&lt;br /&gt;&lt;br /&gt;After a few months we obtained an Arduino. The philosophy of the Arduino is really different from the NXT. (Books can be written on this...:-)&lt;br /&gt;&lt;br /&gt;A bit of research on the internet showed examples of how to connect the NXT to the I2C chip from mindsensors.com: &lt;a href="http://www.tau.ac.il/%7Estoledo/lego/i2c-8574/"&gt;http://www.tau.ac.il/~stoledo/lego/i2c-8574/&lt;/a&gt;&lt;br /&gt;This schema also showes how to connect it in general, so also to the ARDUINO.&lt;br /&gt;With the wiring.h lib of the ARDUINO we can connect to I2C input output ports. So the IC's from the mindsensor I2C kit could be steered using the Arduino too. Maybe we can get the I2C chip working and resolve the problem of the I2C chip and the NXT, finding our mistake with my soldering the mindsensor setup.&lt;br /&gt;But not having too much experience (coming from the NXT, which shields this kind of troubles) we had to figure out the pin config of the chip.&lt;br /&gt;First we were put on the wrong track by the sketch on the page of Silvan Toledo, which suggests quite a different pin config. ( &lt;a href="http://www.tau.ac.il/%7Estoledo/lego/i2c-8574/"&gt;http://www.tau.ac.il/~stoledo/lego/i2c-8574/&lt;/a&gt; )&lt;br /&gt;After a bit of time, (and failure) we found out the right pin config by looking at the datasheet of Philips.&lt;br /&gt;(found here: &lt;a href="http://www.datasheetcatalog.com/datasheets_pdf/P/C/F/8/PCF8574.shtml"&gt;http://www.datasheetcatalog.com/datasheets_pdf/P/C/F/8/PCF8574.shtml&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;And now these IC's worked, we got the address right and we could connect 2 IC's to the same Arduino using different addresses. (More is possible, but we had only two &lt;b&gt;PCF8574A.)&lt;/b&gt;&lt;br /&gt;This gives the possibility to connect up to 8 times 8 LEDS to one Arduino.&lt;br /&gt;(Something for a Led matrix...but these can be steered directly from the ATMega168 in other ways)&lt;br /&gt;&lt;br /&gt;(actually reading &lt;a href="http://nxtasy.org/wp-content/uploads/2006/08/digital%20vs%20analog.pdf"&gt;&lt;cite&gt;&lt;b&gt;nxt&lt;/b&gt;asy.org/wp-content/uploads/2006/08/digital%20vs%20analog.pdf &lt;/cite&gt;&lt;br /&gt;&lt;/a&gt;we can wonder about how many sensors can be connected to the NXT...)&lt;br /&gt;&lt;br /&gt;Actually mindsensors.com ships the &lt;b&gt;PCF8574A, &lt;/b&gt;and not the promised&lt;b&gt; &lt;/b&gt;&lt;b&gt;PCF8574. &lt;/b&gt;Does this make a difference? Actually in the Arduino code i had to change the adress from B0100000 (PCF8574) to B0111000 (PCF8574A)&lt;br /&gt;(this hint was found out here: (also this code was used to test)&lt;br /&gt;&lt;a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1173047782/5"&gt;http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1173047782/5&lt;/a&gt;&lt;br /&gt;)&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Jq__kevBr8s/ScOee8p2UeI/AAAAAAAABRI/2F5A42WFLoE/s1600-h/IMG_0053.JPG"&gt;&lt;img style="cursor: pointer; width: 320px; height: 306px;" src="http://3.bp.blogspot.com/_Jq__kevBr8s/ScOee8p2UeI/AAAAAAAABRI/2F5A42WFLoE/s320/IMG_0053.JPG" alt="" id="BLOGGER_PHOTO_ID_5315266239742235106" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;analog port 4 SDA&lt;br /&gt;analog port 5 SCL (&lt;a href="http://www.neufeld.newton.ks.us/electronics/?p=241"&gt;http://www.neufeld.newton.ks.us/electronics/?p=241&lt;/a&gt; )&lt;br /&gt;&lt;br /&gt;another experiment used one address port A0 to HIGH for the second &lt;b&gt;PCF8574A.&lt;br /&gt;&lt;/b&gt;and the second &lt;b&gt;PCF8574A&lt;/b&gt; could steer LEDS&lt;b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;The next step will be to get back to the NXT, now that we know the adress and the workings of the I2C inport output IC's.&lt;br /&gt;&lt;br /&gt;The comment from Vinh Vu made us review the original text and add links and the picture. Vinh Vu asks how to connect the ULTRA sonic sensor (I2C) to the ARDUINO. The pin fig of the sensor showes the SDA SCL in the connector: connection to the NXT:&lt;br /&gt;&lt;a href="http://forums.nxtasy.org/index.php?showtopic=2092"&gt;http://forums.nxtasy.org/index.php?showtopic=2092&lt;/a&gt;&lt;br /&gt;this works: the ultrasound sensor clicks if the 9V is applied.&lt;br /&gt;&lt;br /&gt;The experience with the bluetooth commands researched in other blogs seems to be the way to go...(? or does the NXT perform special things in between the commands, normally filtered out, to prevent hacking its expensive sensors for the cheapo ARDUINO :-)....&lt;br /&gt;&lt;br /&gt;then looking at the  &lt;span id="ContentAdminRepeater1__ctl0__ctl0_Text"&gt;&lt;strong&gt;Hardware Developer Kit (HDK)&lt;/strong&gt;  &lt;/span&gt; of Lego&lt;br /&gt;&lt;a href="http://mindstorms.lego.com/Overview/nxtreme.aspx"&gt;http://mindstorms.lego.com/Overview/nxtreme.aspx&lt;/a&gt;&lt;br /&gt;you find the communication protocol with the ultrasound sensor...will this work?&lt;br /&gt;&lt;br /&gt;all seems to be understandable, but this remark indicates possibly (the expected) interference of the NXT:&lt;br /&gt;---NXT firmware will deal with the "R + 0x03" part---&lt;br /&gt;&lt;br /&gt;This links explains how to deal with the "R + 0x03" (does it?)&lt;br /&gt;&lt;a href="http://forums.nxtasy.org/lofiversion/index.php?t141.html"&gt;http://forums.nxtasy.org/lofiversion/index.php?t141.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;the above mentioned link explains the R in ARDUINO - wire terms: endtransmission begintransmission -  i did already try it that way...&lt;br /&gt;&lt;br /&gt;anyway first try the most basic: shutting  the sensor off using:&lt;br /&gt;0x02 write address 0x41 internal address 0x00 write zero&lt;br /&gt;&lt;br /&gt;all kind of variations tried out,&lt;br /&gt;Wire.beginTransmission(expander);// tried expander 0x01 and 0x02&lt;br /&gt;&lt;br /&gt;Wire.send(0x41);&lt;br /&gt;Wire.send(0x00);&lt;br /&gt;etc.&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;char a[]= { 0x00, 0x41, 0x00  }; //  {  0x41, 0x00  }&lt;br /&gt;Wire.send(a);&lt;br /&gt;&lt;br /&gt;the sensor still clicks....&lt;br /&gt;so.....&lt;br /&gt;&lt;br /&gt;unsolved problem, better either use the nxt in combination with the Ultrasound and use bluetooth in combination with C#, see bram fokke lib, or use a distance sensor the ARDUINO can handle without a problem?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-8591040500693783238?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/8591040500693783238/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=8591040500693783238' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/8591040500693783238'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/8591040500693783238'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/12/nxt-arduino-and-i2c.html' title='NXT Arduino and I2C'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Jq__kevBr8s/ScOee8p2UeI/AAAAAAAABRI/2F5A42WFLoE/s72-c/IMG_0053.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-2955284159526501189</id><published>2008-06-26T07:18:00.000-07:00</published><updated>2008-12-10T02:07:07.459-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LEJOS JAVA'/><category scheme='http://www.blogger.com/atom/ns#' term='playstation'/><category scheme='http://www.blogger.com/atom/ns#' term='PSP-NX'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>PSP-NX and the lejos JAVA class</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Jq__kevBr8s/SGOpFy1B25I/AAAAAAAAAz0/vBOo5wiTy3U/s1600-h/psp.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_Jq__kevBr8s/SGOpFy1B25I/AAAAAAAAAz0/vBOo5wiTy3U/s320/psp.jpg" alt="" id="BLOGGER_PHOTO_ID_5216198710433799058" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;This PSP-NX sensor (www.mindsensors.com) can receive signals from the Sony Playstation controller and this input can be used to steer the motors or activate other sensors on the brick.&lt;/span&gt; &lt;span style="font-family:arial;"&gt;In this sense this PSP-NX sensor is not a real sensor, not measuring "physical" data like light or sound.&lt;/span&gt; &lt;span style="font-family:arial;"&gt;On the other hand it is funny to be able to steer the NXT around with the conveniance of this controler. Really convenient.&lt;/span&gt; &lt;span style="font-family:arial;"&gt;The PSP is base on I2C so it is not the fasted around.&lt;/span&gt; &lt;span style="font-family:arial;"&gt;Of course, because activating commands must be sent to the I2C sensor chip, this sensor has to be controlled in a prog from the brick, like the Camera, no bluetooth control of this sensor.&lt;/span&gt;  &lt;span style="font-family:arial;"&gt;We made the JAVA lejos class for this sensor:&lt;/span&gt; &lt;span style="font-family:arial;"&gt;The only problem was (again, like the clock sensor) the strange handling of the COMMAND address by lejos JAVA: is has to be divided by 2!!! (See also the clock sensor class in this blogg)&lt;/span&gt;  &lt;span style="font-family:arial;"&gt;For the rest the buttons1 and button2 have to be decoded:&lt;/span&gt; &lt;span style="font-family:arial;"&gt;Button 2 digits:&lt;/span&gt; &lt;span style="font-family:arial;"&gt;    1 left down&lt;/span&gt; &lt;span style="font-family:arial;"&gt;    2 right down&lt;/span&gt; &lt;span style="font-family:arial;"&gt;    4 left up&lt;/span&gt; &lt;span style="font-family:arial;"&gt;    8 right up&lt;/span&gt; &lt;span style="font-family:arial;"&gt;triangle        16&lt;/span&gt; &lt;span style="font-family:arial;"&gt;circle            32&lt;/span&gt; &lt;span style="font-family:arial;"&gt;cross            64&lt;/span&gt; &lt;span style="font-family:arial;"&gt;square         128&lt;/span&gt;  &lt;span style="font-family:arial;"&gt;Button1 digits:&lt;/span&gt; &lt;span style="font-family:arial;"&gt;1 select&lt;/span&gt; &lt;span style="font-family:arial;"&gt;8 start&lt;/span&gt; &lt;span style="font-family:arial;"&gt;16 left circle up&lt;/span&gt; &lt;span style="font-family:arial;"&gt;32 left circle left&lt;/span&gt; &lt;span style="font-family:arial;"&gt;64 left circle down&lt;/span&gt; &lt;span style="font-family:arial;"&gt;128 left circle left&lt;/span&gt;  &lt;span style="font-family:arial;"&gt;then the joysticks, the mode has to be analog, and then you have a nice range of 0 - 255 for both x and y directions&lt;/span&gt; &lt;table style="font-family: arial;" border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;//JAVA class:&lt;br /&gt;import lejos.nxt.*;&lt;br /&gt;&lt;br /&gt;public class playstation extends I2CSensor implements SensorConstants&lt;br /&gt;{&lt;br /&gt; // Mindsensors.com constants:&lt;br /&gt; private final static byte COMMAND = 0x02 / 2;//here the strange lejos divide by 2 to get address&lt;br /&gt; private final static byte SENDADDRESS = 0x41 / 2;//to send the activation etc&lt;br /&gt;&lt;br /&gt; byte[] buf = new byte[2];&lt;br /&gt; SensorPort myPort;&lt;br /&gt;&lt;br /&gt; public playstation(SensorPort port)&lt;br /&gt; {&lt;br /&gt;     super(port);&lt;br /&gt;     myPort = port;&lt;br /&gt;     activate();&lt;br /&gt;     pause(100);&lt;br /&gt;     analog();&lt;br /&gt;     pause(100);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public void activate()&lt;br /&gt; {&lt;br /&gt;     buf[0] = 'E';&lt;br /&gt;     super.sendDataSENDADDRESS , buf, 1);//energize&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public void deactivate()&lt;br /&gt; {&lt;br /&gt;     buf[0] = 'D';&lt;br /&gt;     super.sendData(SENDADDRESS , buf, 1);//power off&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public void digital()&lt;br /&gt; {&lt;br /&gt;     buf[0] = 'A';&lt;br /&gt;     super.sendData(SENDADDRESS , buf, 1);//digital mode&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public void analog()&lt;br /&gt; {&lt;br /&gt;     buf[0] = 's';&lt;br /&gt;     super.sendData(SENDADDRESS , buf, 1);//analog mode (for working joysticks)&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public void ADPAON()&lt;br /&gt; {&lt;br /&gt;     buf[0] = 'N';&lt;br /&gt;     super.sendData(SENDADDRESS , buf, 1);//connecting more sensors to one sensorport&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public void ADPAOFF()&lt;br /&gt; {&lt;br /&gt;     buf[0] = 'O';&lt;br /&gt;     super.sendData(SENDADDRESS , buf, 1);//not connecting more sensors to one sensorport&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public int getData(int register, byte [] buf, int len) {&lt;br /&gt;     int ret = myPort.i2cStart(COMMAND   , register, len, buf, len, 0);&lt;br /&gt;     if (ret != 0) return ret;&lt;br /&gt;     while (myPort.i2cBusy() != 0) {&lt;br /&gt;         Thread.yield();&lt;br /&gt;     }&lt;br /&gt;     return 0;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;public String getMyProductID()&lt;br /&gt;   {&lt;br /&gt;       String version = "        ";&lt;br /&gt;       char [] versionChars = StringUtils.getCharacters(version);&lt;br /&gt;       byte[] byteBuff = new byte[8];&lt;br /&gt;       int ret = getData(0x00, byteBuff, 8);&lt;br /&gt;&lt;br /&gt;       for(int i=0;i&lt;8;i++) {             versionChars[i] = (ret == 0 ? (char) byteBuff[i] : ' ');         }           &lt;br /&gt;return version;&lt;br /&gt; }        &lt;br /&gt;&lt;br /&gt;public String getMyDeviceID()&lt;br /&gt; {        &lt;br /&gt;String version = "        ";         char [] versionChars = StringUtils.getCharacters(version);        &lt;br /&gt;byte[] byteBuff = new byte[8];        &lt;br /&gt;int ret = getData(0x10, byteBuff, 8);         &lt;br /&gt;for(int i=0;i&lt;8;i++) {             versionChars[i] = (ret == 0 ? (char) byteBuff[i] : ' ');        &lt;br /&gt;}           &lt;br /&gt;return version;&lt;br /&gt; }        &lt;br /&gt;&lt;br /&gt;public String getMyVendorID()&lt;br /&gt; {        &lt;br /&gt;String version = "        ";        &lt;br /&gt;char [] versionChars = StringUtils.getCharacters(version);        &lt;br /&gt;byte[] byteBuff = new byte[8];        &lt;br /&gt;int ret = getData(0x08, byteBuff, 8);         &lt;br /&gt;for(int i=0;i&lt;8;i++)&lt;br /&gt; {             versionChars[i] = (ret == 0 ? (char) byteBuff[i] : ' ');        &lt;br /&gt;}           &lt;br /&gt;return version;    &lt;br /&gt;}        &lt;br /&gt;&lt;br /&gt;public int Button1()&lt;br /&gt;{&lt;br /&gt; int ret = getData(0x42, buf, 1);        &lt;br /&gt;return (ret == 0 ? ( 255 -  buf[0] &amp;amp; 0xFF  ) : -1);    &lt;br /&gt;}    &lt;br /&gt;&lt;br /&gt;public int Button2()&lt;br /&gt; {         int ret = getData(0x43, buf, 1);         &lt;br /&gt;return (ret == 0 ? ( 255 - buf[0] &amp;amp; 0xFF  ) : -1);    &lt;br /&gt;}            &lt;br /&gt;&lt;br /&gt;public int xLeftJoystick()    &lt;br /&gt;{         int ret =  getData(0x44, buf, 1);        &lt;br /&gt;return (ret == 0 ? (buf[0] &amp;amp; 0xFF ) : -1);    &lt;br /&gt;}    &lt;br /&gt;&lt;br /&gt;public int yLeftJoystick()    &lt;br /&gt;{         int ret =  getData(0x45, buf, 1);        &lt;br /&gt;return (ret == 0 ? (buf[0] &amp;amp; 0xFF ) : -1);&lt;br /&gt; }    &lt;br /&gt;&lt;br /&gt;public int xRightJoystick()&lt;br /&gt; {         int ret =  getData(0x46, buf, 1);        &lt;br /&gt;return (ret == 0 ? (buf[0] &amp;amp; 0xFF ) : -1);&lt;br /&gt; }    &lt;br /&gt;&lt;br /&gt;public int yRightJoystick()&lt;br /&gt; {         int ret =  getData(0x47, buf, 1);        &lt;br /&gt;return (ret == 0 ? (buf[0] &amp;amp; 0xFF ) : -1);    &lt;br /&gt;}    &lt;br /&gt;&lt;br /&gt;private static void pause(int time)      &lt;br /&gt;{          &lt;br /&gt;try{ Thread.sleep(time);&lt;br /&gt; }          &lt;br /&gt;catch(InterruptedException e){}      &lt;br /&gt;}&lt;br /&gt;}&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span style="font-family:arial;"&gt;With this class we made a nice prog in JAVA to steer the brick around.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-2955284159526501189?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/2955284159526501189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=2955284159526501189' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2955284159526501189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2955284159526501189'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/06/psp-nx-and-lejos-java-class.html' title='PSP-NX and the lejos JAVA class'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Jq__kevBr8s/SGOpFy1B25I/AAAAAAAAAz0/vBOo5wiTy3U/s72-c/psp.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-7054067205303108270</id><published>2008-05-06T01:10:00.000-07:00</published><updated>2008-05-12T00:08:34.679-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='follow'/><category scheme='http://www.blogger.com/atom/ns#' term='nxtcam'/><category scheme='http://www.blogger.com/atom/ns#' term='drawing'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>nxt camera following</title><content type='html'>&lt;object width="425" height="350"&gt; &lt;param name="movie" value="http://www.youtube.com/v/-a6hbP76080"&gt; &lt;/param&gt; &lt;embed src="http://www.youtube.com/v/-a6hbP76080" type="application/x-shockwave-flash" width="425" height="350"&gt; &lt;/embed&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;all speaking for itself we think......(nxt is provided with a felt-tipped pen)&lt;br /&gt;he will become a great artist this nxt&lt;br /&gt;:-)&lt;br /&gt;&lt;br /&gt;the prog has 2 modes: one displaying the light source on the screen, for checking what the nxt "sees". This is not very predictable from our human point of view. The second mode, if the responses are adequate, is direct reactions of the two motors to visual input.&lt;br /&gt;&lt;br /&gt;left right movements are just seeing the source left right&lt;br /&gt;forward backwards is done by detecting the source above or under the middle of the field of vision.&lt;br /&gt;&lt;br /&gt;The movements should become more smooth.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-7054067205303108270?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/7054067205303108270/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=7054067205303108270' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7054067205303108270'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7054067205303108270'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/05/nxt-camera-following.html' title='nxt camera following'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-7056156845748959636</id><published>2008-04-22T06:04:00.000-07:00</published><updated>2008-12-10T02:07:07.974-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='nxt-model'/><category scheme='http://www.blogger.com/atom/ns#' term='lejos'/><category scheme='http://www.blogger.com/atom/ns#' term='clock sensor'/><category scheme='http://www.blogger.com/atom/ns#' term='Hopper'/><category scheme='http://www.blogger.com/atom/ns#' term='Laurens'/><title type='text'>Hopper</title><content type='html'>&lt;object width="425" height="350"&gt; &lt;param name="movie" value="http://www.youtube.com/v/nBOcpob2XOw"&gt; &lt;/param&gt; &lt;embed src="http://www.youtube.com/v/nBOcpob2XOw" type="application/x-shockwave-flash" width="425" height="350"&gt; &lt;/embed&gt; &lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;We found this model of Laurens on the web:&lt;br /&gt;&lt;a href="http://ricquin.net/lego/laurens/"&gt;http://ricquin.net/lego/laurens/&lt;/a&gt;&lt;br /&gt;We got interested because of the use of the special Lego piece which we already used "in concept" for a gear box, see blog : &lt;a href="http://nxt-adventures.blogspot.com/2008/02/gearbox-of-jos.html"&gt;gearbox of Jos. &lt;/a&gt;Here it is used to turn the model, the foot being attached to the inner circle, the motor to turn it, to the black outer half of this lego piece.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Jq__kevBr8s/SA3nniYFlkI/AAAAAAAAAyg/d2Hp55q5t_4/s1600-h/hopper2.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://3.bp.blogspot.com/_Jq__kevBr8s/SA3nniYFlkI/AAAAAAAAAyg/d2Hp55q5t_4/s320/hopper2.jpg" alt="" id="BLOGGER_PHOTO_ID_5192060611856799298" border="0" /&gt;&lt;/a&gt;The Hopper is complicated and simple at the same time, the good thing of building models as examples is that you see how others use the Lego pieces to construct, there is always something to learn. For instance the use of the double black triangles.&lt;br /&gt;Also we see Pythagoras is still working in a small triangle:  square 8 + square 6 =  square  10: the famous 3:4:5 trangle!&lt;br /&gt;Ingenious is the way to combine the two motors to get the Hopper movement.&lt;br /&gt;The use of the sensor is reduced: the ultrasonic sensor measures the distance and the Hopper turns when the distance is too small.&lt;br /&gt;This turning is really something nice: first the thing turns on the middle foot, then it lift itself half a cycle, and the foot is turned, then another half cycle and the Hopper continues its way.&lt;br /&gt;&lt;br /&gt;With the building instructions comes the NXT-G or firmware program.&lt;br /&gt;It is really a beauty programm: where the FIRMWARE can be very concise:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Jq__kevBr8s/SA3noCYFllI/AAAAAAAAAyo/_0FMcwr-cso/s1600-h/hopper.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://1.bp.blogspot.com/_Jq__kevBr8s/SA3noCYFllI/AAAAAAAAAyo/_0FMcwr-cso/s320/hopper.jpg" alt="" id="BLOGGER_PHOTO_ID_5192060620446733906" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We redid this program in Lejos-Java, it become somewhat longer.&lt;br /&gt;Think of the synchronisation: adding the true in the Motor.A.rotate(360, true);&lt;br /&gt;&lt;br /&gt;Here is the Lejos JAVA version of this prog: (somehow it looks more complicated, it isn't of course...)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;table  border="1" style="font-family:arial;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;//HOPPER JAVA&lt;br /&gt;&lt;br /&gt;import lejos.nxt.Button;&lt;br /&gt;import lejos.nxt.LCD;&lt;br /&gt;import lejos.nxt.Motor;&lt;br /&gt;import lejos.nxt.SensorPort;&lt;br /&gt;import lejos.nxt.Sound;&lt;br /&gt;import lejos.nxt.UltrasonicSensor;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* leJOS version of the HOPPER program by Laurens&lt;br /&gt;*&lt;br /&gt;*&lt;br /&gt;* @author Five March&lt;br /&gt;*&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;public class walker {&lt;br /&gt;&lt;br /&gt;public static void main(String[] args )&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;  Motor.A.smoothAcceleration(true);&lt;br /&gt;  Motor.B.smoothAcceleration(true);&lt;br /&gt;  Motor.C.smoothAcceleration(true);&lt;br /&gt;&lt;br /&gt;  UltrasonicSensor sonar = new UltrasonicSensor(SensorPort.S1);&lt;br /&gt;&lt;br /&gt;  Motor.A.setSpeed(200);&lt;br /&gt;  Motor.B.setSpeed(200);&lt;br /&gt;  Motor.C.setSpeed(200);&lt;br /&gt;    //--------------------------------------------------------&lt;br /&gt;  Sound.beep();//we are starting&lt;br /&gt;  LCD.clear();&lt;br /&gt;  while(!Button.ESCAPE.isPressed()  )&lt;br /&gt;  {&lt;br /&gt;      LCD.drawInt(sonar.getDistance(), 0, 2);//to test draw the distance on the LCD screen&lt;br /&gt;      LCD.refresh();&lt;br /&gt;&lt;br /&gt;  if (sonar.getDistance() &gt; 25)&lt;br /&gt;  {&lt;br /&gt;      Motor.A.rotate(360, true);&lt;br /&gt;      Motor.B.rotate(-360, true);&lt;br /&gt;      pause(1500);&lt;br /&gt;  }&lt;br /&gt;  else{&lt;br /&gt;      Sound.beep();//encounter an obstacle&lt;br /&gt;      int rotateAngle = 0;&lt;br /&gt;      while ( sonar.getDistance() &lt;50)&gt;           &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;br /&gt;Because of the middle foot turning around, we thought of adding the "radar" possibility, making a map of surrounding objects. We already did this using the fantom lib and a very simple model.&lt;br /&gt;&lt;br /&gt;But then we have to shift the software, choose a lib, so fantom lib, why not, this is JAVA too.&lt;br /&gt;Now we'll do the commanding from the PC.&lt;br /&gt;&lt;br /&gt;We add a few other sensors, the compass sensor, to get a bearing when making the map, the time, and the sound.&lt;br /&gt;&lt;br /&gt;The sound will be used to get from the "Hopper"-mode into the mapping - mode.&lt;br /&gt;&lt;br /&gt;The sensors will be mounted at the side of the model, the inside, because at the start, the thing had a tendency to fall down....( i forgot one tiny bit of lego, :-)&lt;br /&gt;&lt;br /&gt;This is the result (output from Eclipse, beautified in Photoshop...)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Jq__kevBr8s/SBCQKiYFlmI/AAAAAAAAAyw/kdDXW8BUaHo/s1600-h/hopper-export.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_Jq__kevBr8s/SBCQKiYFlmI/AAAAAAAAAyw/kdDXW8BUaHo/s320/hopper-export.jpg" alt="" id="BLOGGER_PHOTO_ID_5192808881059108450" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;The red line gives the "hopps", then the hopper encounters an object, and starts a round of getting distances, then it decides to take a bearing without an object (white line: no object within range) and it continues till it senses another something near.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;The process of scouting a room is very slow. The sensors have to be not moving while reading a value.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Also you can see the compass is not very horizontal, because the lines around the "radaring" point should be regularly rotating around this point.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;At the moment the nxt can avoid obstacles, but the track it follows is still random. The next step will be an "intelligent" way to search a room and make a map of the objects in it.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;br /&gt;to be continued....&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-7056156845748959636?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/7056156845748959636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=7056156845748959636' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7056156845748959636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7056156845748959636'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/04/hopper.html' title='Hopper'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Jq__kevBr8s/SA3nniYFlkI/AAAAAAAAAyg/d2Hp55q5t_4/s72-c/hopper2.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-3607896104470483241</id><published>2008-04-19T08:17:00.001-07:00</published><updated>2008-12-10T02:07:08.523-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='camera senosr'/><category scheme='http://www.blogger.com/atom/ns#' term='bluetooth'/><category scheme='http://www.blogger.com/atom/ns#' term='master slave'/><category scheme='http://www.blogger.com/atom/ns#' term='nxtcam'/><title type='text'>nxtcamera</title><content type='html'>At last, after experimenting a lot with bluetooth and the I2C sensors we had enough experience to start working with the more complicated camera sensor. We thought!&lt;br /&gt;&lt;br /&gt;Because we started trying to read out the objects the camera sensor saw from the fantom lib, we got stuck! Nothing was seen.&lt;br /&gt;After a lot of trying out different settings we discovered and concluded that in the bluetooth setting the commands A and E for setting up the sensor were not received.&lt;br /&gt;We started trying out the clock sensor, which has RAM registers, and we tried out setting the clock, all using bluetooth. This didn't work. So in the end we remembered reading somewhere about the master slave concept and tested a prog on the brick. In this prog, so without using bluetooth, the camera registers could be set, and it started tracking objects.&lt;br /&gt;&lt;br /&gt;As expected the tracking of objects is not a very sensitive proces. The colors have to be well set in the PC prog NXTCAMVIEW, then uploaded. All depends on the setting of the light in the environment. But in the end it worked and we learnt again about some other complexities of the NXT.&lt;br /&gt;&lt;br /&gt;Here an example in Lejos JAVA using the nxtcam, it draws the recognized blob on the LCD screen and can be expanded to an NXT following this blob...&lt;br /&gt;&lt;br /&gt;&lt;table border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;import java.awt.Rectangle;&lt;br /&gt;import javax.microedition.lcdui.Graphics;&lt;br /&gt;import lejos.nxt.Button;&lt;br /&gt;import lejos.nxt.NXTCam;&lt;br /&gt;import lejos.nxt.Sound;&lt;br /&gt;import lejos.nxt.LCD;&lt;br /&gt;import lejos.nxt.SensorPort;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;* Demonstration of leJOS nxtcam&lt;br /&gt;*&lt;br /&gt;* draws the rectangle of a recognized color on the LCD screen&lt;br /&gt;* gives different beeps for the two sides of the screen (left right)&lt;br /&gt;* can be used to steer motors to make a following NXT&lt;br /&gt;*&lt;br /&gt;* uses one very good recognizable color entered with NXTCAMVIEW&lt;br /&gt;*&lt;br /&gt;* @author Five March&lt;br /&gt;*&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;public class follow   {&lt;br /&gt;&lt;br /&gt; static NXTCam cam = new NXTCam(SensorPort.S1);&lt;br /&gt; static Rectangle myRect = new Rectangle();&lt;br /&gt; static Sound beep;&lt;br /&gt;&lt;br /&gt; public static void main(String[] args )&lt;br /&gt; {&lt;br /&gt;     Graphics g = new Graphics();//to draw a rectangle on the screen&lt;br /&gt;&lt;br /&gt;   //--------------------------------------------------------&lt;br /&gt;     Sound.beep();//we are starting&lt;br /&gt;     cam.sendCommand('A');//preparation of the camera: sort objects&lt;br /&gt;     cam.sendCommand('E');//start camera tracking&lt;br /&gt;    //--------------------------------------------------------&lt;br /&gt;     while(!Button.ESCAPE.isPressed()  )&lt;br /&gt; {&lt;br /&gt;     int nb = cam.getNumberOfObjects() ;&lt;br /&gt;     if (nb ==1 )&lt;br /&gt;         {&lt;br /&gt;             LCD.clear();&lt;br /&gt;&lt;br /&gt;             g.drawRect(0,0,98,63);//max width on screen&lt;br /&gt;         &lt;br /&gt;             myRect =  cam.getRectangle(0);//the biggest rectangle seen by the camera&lt;br /&gt;             double scale = .6;//the camera width is different from the LCD with&lt;br /&gt;&lt;br /&gt;             int rectWidth = (int)(scale*myRect.width);&lt;br /&gt;             int middle =  (int)(scale*myRect.x) + (int)(.5*rectWidth);&lt;br /&gt;             g.drawRect((int)(scale*myRect.x), (int)(scale*myRect.y), (int)(scale*myRect.width), (int)(scale*myRect.height));&lt;br /&gt;             //Integer midInt = new Integer(middle);//JAVA way of doing difficult converting an int to a String&lt;br /&gt;             //g.drawString( midInt.toString(),1,1);&lt;br /&gt;             g.refresh();&lt;br /&gt;         &lt;br /&gt;             if (middle &gt; 50 )&lt;br /&gt;                 beep.playTone(2000, 100);//shape to the right&lt;br /&gt;             else&lt;br /&gt;                 beep.playTone(4000, 100);//shape to the left&lt;br /&gt;     &lt;br /&gt;             pause(100);//small pause otherwise the rectangles are only partially drawn&lt;br /&gt;         }&lt;br /&gt; }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;  public static void pause(int time)&lt;br /&gt;   {&lt;br /&gt;       try{ Thread.sleep(time);&lt;br /&gt;   }&lt;br /&gt;       catch(InterruptedException e){}&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Jq__kevBr8s/SAw5thS5wOI/AAAAAAAAAyY/YaSRbVqSBqo/s1600-h/Image1.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_Jq__kevBr8s/SAw5thS5wOI/AAAAAAAAAyY/YaSRbVqSBqo/s320/Image1.jpg" alt="" id="BLOGGER_PHOTO_ID_5191587924645888226" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;to be continued...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-3607896104470483241?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/3607896104470483241/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=3607896104470483241' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/3607896104470483241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/3607896104470483241'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/04/nxtcamera.html' title='nxtcamera'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Jq__kevBr8s/SAw5thS5wOI/AAAAAAAAAyY/YaSRbVqSBqo/s72-c/Image1.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-296443550112612076</id><published>2008-04-19T07:38:00.001-07:00</published><updated>2008-04-19T10:09:51.534-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='clock sensor'/><category scheme='http://www.blogger.com/atom/ns#' term='bluetooth'/><category scheme='http://www.blogger.com/atom/ns#' term='master slave'/><category scheme='http://www.blogger.com/atom/ns#' term='nxtcam'/><category scheme='http://www.blogger.com/atom/ns#' term='I2CSensor'/><title type='text'>Master Slave</title><content type='html'>&lt;span style="font-family: arial;font-size:85%;" &gt;Using bluetooth you can steer the NXT.&lt;br /&gt;This steering, commanding and reading of sensors can be done from several programming environments, like the fantom lib, or the C++ or the C# lib, many others available. For all these libs there is a limit to what can be done due to the master slave concept.&lt;br /&gt;&lt;br /&gt;Working with several sensors all went well.&lt;br /&gt;But trying out the camera sensor we ran into trouble: this camera has to be put in tracking mode by setting a register on this I2C sensor.&lt;br /&gt;&lt;br /&gt;We discovered after quite a bit of time that the setting of registers by sending of DIRECT COMMANDS using bluetooth was not working.&lt;br /&gt;&lt;br /&gt;Only by a prog on the brick, in our case in JAVA lejos, the camera can be set into tracking mode.&lt;br /&gt;The same is true for setting the time on the clock sensor. We had written a method in the clock C++ class for setting the time, but this method can be thrown away.&lt;br /&gt;&lt;br /&gt;The idea is that in the bluetooth relation there is a master and a slave. The master, in this case the NXT brick can set registers of the sensors, the slave, apparently (for us the PC) cannot.&lt;br /&gt;&lt;br /&gt;So the sensors can be read, but not really put into other modes by the LSWRITE command.&lt;br /&gt;&lt;br /&gt;This means that changing the factory address of an I2C sensor must be done on the brick too.&lt;br /&gt;(Changing this address of an I2C sensor is necessary when connecting several I2C sensors to the same sensor port. The method is described in the mindsensors sheets.)&lt;br /&gt;&lt;br /&gt;This resolves a few days of frustration, trying to get the camera sensor working.&lt;br /&gt;After making a JAVA Lejos prog and transferring it to the brick, the camera was tracking without any problems, given that the colors of the objects to be tracked were defined in the NXTCAM view prog.&lt;br /&gt;&lt;br /&gt;searching further, i came across this site: &lt;a href="http://www.pspwp.pwp.blueyonder.co.uk/science/robotics/nxt/index.html"&gt;http://www.pspwp.pwp.blueyonder.co.uk/science/robotics/nxt/index.html&lt;/a&gt;&lt;br /&gt;having a prog to steer the nxt&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-296443550112612076?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/296443550112612076/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=296443550112612076' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/296443550112612076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/296443550112612076'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/04/master-slave.html' title='Master Slave'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-6771615026702712670</id><published>2008-04-05T00:49:00.000-07:00</published><updated>2008-04-19T07:34:39.494-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fantom lib'/><category scheme='http://www.blogger.com/atom/ns#' term='Direct Commands'/><category scheme='http://www.blogger.com/atom/ns#' term='bluetooth'/><category scheme='http://www.blogger.com/atom/ns#' term='I2CSensor'/><category scheme='http://www.blogger.com/atom/ns#' term='set up'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>trying to make sense of the I2C setup</title><content type='html'>&lt;span style=";font-family:arial;font-size:85%;"  &gt;Warning: this is a kind of diary of the problems you will encounter playing with the NXT!&lt;br /&gt;Where is my time gone? What did I do with my life?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Ok the problems described here are solved, as always it was a combination of a few causes, a wrong setting of the battery reading before starting the reading of the sensors messed up the rest of the readings.&lt;br /&gt;In the fantom api you have to be careful destinguishing between the bytes read by LSREAD and the bytes read through the fantomlib SENDDIRECTCOMMANDS, also the description of the DIRECT COMMANDS in the Bluetooth Developers Kit has to be read with care, not being quite what it is....so:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: arial;"&gt; fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, true, command, command.capacity(), response, response.length, status);&lt;br /&gt;reads 4 bytes (see &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: arial;"&gt;getBattery() in &lt;a href="http://nxt-adventures.blogspot.com/2008/03/fantom-api-and-java.html"&gt;fantom lib blog )&lt;/a&gt;&lt;br /&gt;but this is different from a reading of a sensor which starts with LSWRITE to the sensor and then used LSWRITE again to read the 21 bytes coming in...&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;br /&gt;To give an account of some of the difficulties and mistakes occuring during "research" i leave this story here......&lt;br /&gt;&lt;br /&gt;But a nice training in detective work!&lt;br /&gt;I am recording our efforts and thoughts, if something works all the roundabouts are so quickly forgotten!&lt;br /&gt;&lt;br /&gt;we started having an idea of making a "room mapping" robot,&lt;br /&gt;first we used C++ to do the job, with bluetooth, we could have mapped in OpenGL but we didn't, did that in FLASH.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;(We just happen to like mixing all kind of environments:-)&lt;/span&gt;&lt;br /&gt;then we discovered the fantom api and could get all the JAVA working on the brick and the PC&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;(This is fun: Lejos JAVA on the brick and fantom lib JAVA on the PC.)&lt;/span&gt;&lt;br /&gt;so we redid the mapping idea using our homebrew lib, built on the fantom interface of E. Pirsch.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;(Learning a lot about the DIRECT COMMANDS and the I2C sensors, but we had to learn more....:-(&lt;/span&gt;&lt;br /&gt;mapping objects around the NXT worked but then it turned out the combination of 2 I2C sensors got mixed up&lt;br /&gt;the sonar reading coming in during a compass reading.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;(This is not the way we want it!!!! All must be neatly fit into it own objects!!!)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;we started researching why, and we found this strange I2C set up procedure.&lt;br /&gt;We are trying to make sense of this, and hoping to do a better job then just discarding the first 5 or 6 measurements.&lt;br /&gt;The different sensors ask for different numbers of bits, and because the set up seems to be done only once, even if you use more and/or different I2C sensors.&lt;br /&gt;&lt;br /&gt;So resuming:&lt;br /&gt;Working with &lt;a href="http://nxt-adventures.blogspot.com/2008/03/fantom-api-and-java.html"&gt;the fantom api &lt;/a&gt;we made a radar, that means the NXT mapping the distance to objects around it.&lt;br /&gt;For this we used two different I2C sensors: compass and sonar.&lt;br /&gt;Making a map of objects around the NXT worked but there was a problem: the distance value came in as a angle and the compass value as a distance.&lt;br /&gt;&lt;br /&gt;The values read where coming in, but in the wrong order. Something wrong with our classes? This seemed in order...&lt;br /&gt;It could be understood if we see the responses to the DIRECT COMMANDS as being read in the order they come in, and having started with the wrong reading. The instances of the objects don't "know" what they are reading, since there is no signature provided from the I2C response. Another reason could be that the setup order must be followed in the reading order, this makes sens if the bytes are "waiting" to be read, and cannot be skipped, neither recognized.&lt;br /&gt;This was confirmed using three I2C sensor measurements (from different sensors). The values were still coming in, but all shifted into the "wrong instance" of the I2C sensor.&lt;br /&gt;&lt;br /&gt;In the end we considered the setup of the I2C sensor:&lt;br /&gt;This is what we got: (coming in)&lt;br /&gt;&lt;br /&gt;recording the preparation of the I2C mode: (reading bytes with LSREAD 21 at a time)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;table  style="width: 482px; height: 190px;font-family:arial;" border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size:85%;"&gt;reading a byte at a time, but getting this value in by 21 at the time:&lt;br /&gt;I2Cprep 14 0 1 20 0 2 16 0 1 -1 0 0 0 0 0 0&lt;br /&gt;I2Cprep 0 2 14 0 1 20 0 2 16 0 1 2 -1 0 0 0&lt;br /&gt;I2Cprep 14 0 1 4 0 2 14 0 1 20 0 0 2 16 0 1&lt;br /&gt;I2Cprep 14 0 1 4 0 2 14 0 1 4 0 0 2 14 0 1&lt;br /&gt;I2Cprep 0 2 14 0 1 4 0 2 14 0 1 2 4 0 2 14&lt;br /&gt;I2Cprep 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0&lt;br /&gt;&lt;br /&gt;after this came a "normal" reading:&lt;br /&gt;normal measurement (byte[3] is the value)&lt;br /&gt;16 0 1 46 0 0 0 0 0 0 0 0 0 0 0 0&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;br /&gt;trying to make sense of this: (taking the 14 for LSGETSTATUS signature)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;table  style="width: 619px; height: 298px;font-family:arial;" border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;14 0 1 20 0 2                       = LSGETSTATUS (?)&lt;br /&gt;16 0 1 46 0 0 0 0 0 0 0 2 this seems like a normal measurement? - 1&lt;br /&gt;14 0 1 20 0 2                      LSGETSTATUS (?)&lt;br /&gt;16 0 1 2 46 0 0 0               this seems like starting a normal measurement? - 2&lt;br /&gt;14 0 1 4 0 2                        LSGETSTATUS (?)&lt;br /&gt;14 0 1 20 0 0 2                  LSGETSTATUS (?)&lt;br /&gt;16 0 1                                  this seems like starting a normal measurement? - 3&lt;br /&gt;14 0 1 4 0 2                        LSGETSTATUS (?)&lt;br /&gt;14 0 1 4 0 0 2                    LSGETSTATUS (?)&lt;br /&gt;14 0 1 0 2                          LSGETSTATUS (?)&lt;br /&gt;14 0 1 4 0 2                       LSGETSTATUS (?)&lt;br /&gt;14 0 1 2 4 0 2                    LSGETSTATUS (?)&lt;br /&gt;14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0&lt;br /&gt;&lt;br /&gt;later on from calling &lt;/span&gt;&lt;span style="font-size:85%;"&gt;LSGETSTATUS intead of readbytes, this 14 could be seen as: "number of bytes in waiting, ready to be read"&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;br /&gt;provoking these bytes were 6 reading of the I2c sensor.&lt;br /&gt;In the C++ Anders lib we find for the I2C compass sensor three reading in preparation:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;table  style="width: 482px; height: 190px;font-family:arial;" border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;from the Anders lib:(with his comment)&lt;br /&gt;&lt;br /&gt;int Compass::setup(){&lt;br /&gt;sensor.sensor_type(LOWSPEED);&lt;br /&gt;Sleep(500);&lt;br /&gt;degree();&lt;br /&gt;degree();&lt;br /&gt;degree();//Otherwise the first measurement fails&lt;br /&gt;return 1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;//degree is reading two bytes at a time, so six bytes are read? No, because the LSGETSTATUS gives the number of bytes ready, but the reading is always in 21 bytes, the 3 and 4 being the value. This difference between bytes ready and bytes read does not make life easier.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;Another things we saw is that even if there are 2 I2C sensors attached to the ports that the preparation takes the same number of bytes, the second sensor, on another port,  is also ready.&lt;br /&gt;&lt;br /&gt;There is no difference in the bytes coming in using LOWSPEED or LOWSPEED_9V as sensor mode.&lt;br /&gt;&lt;br /&gt;The problem is that is takes six measurements to "clear" the I2C sensor communication, but an uneven number to get the right order in the readings. So in case of two sensors should we also introduce a dummy measurement?&lt;br /&gt;&lt;br /&gt;We tried building a method in the our I2C class reading the 14 bytes, but then we have to provide the portnumber, and the address to read from in the sensor (which differs, sonar 0x41, clock 0x00 for instance) so this solution could not be considered very cool, giving the different sensors.&lt;br /&gt;&lt;br /&gt;Experimenting around with different kinds of set ups did not improve the result, the sonar sensor, which reads one byte, and the compass sensor, which reads two, both need three readings before behaving "normal".&lt;br /&gt;&lt;br /&gt;to be continued...&lt;br /&gt;&lt;br /&gt;A probable solution could be changing the address of the compass sensor. We tried this. It failed!&lt;br /&gt;We re-used the Robot-C format found in the blog of&lt;br /&gt;Done something wrong?&lt;br /&gt;Ok, in C++ then, the lib of Anders, hm, no method to change the address found here.&lt;br /&gt;We made a method for the compass, it failed!&lt;br /&gt;But making a I2C sensor array of clock, distance, and compass in a C++ setup did work without problems, only the reading came in at a speed of (this three together) around 2 seconds.....a bit slow, but no shifted readings.....&lt;br /&gt;so if we dont put I2C sensors on the same port, we dont have to change the I2C address?&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-6771615026702712670?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/6771615026702712670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=6771615026702712670' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/6771615026702712670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/6771615026702712670'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/04/trying-to-make-sense-of-i2c-setup.html' title='trying to make sense of the I2C setup'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-8763237508522610308</id><published>2008-03-24T12:19:00.000-07:00</published><updated>2008-12-10T02:07:52.165-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='fantom API'/><category scheme='http://www.blogger.com/atom/ns#' term='lejos'/><category scheme='http://www.blogger.com/atom/ns#' term='bluetooth'/><category scheme='http://www.blogger.com/atom/ns#' term='emmanuel pirsch'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>fantom API and JAVA</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;found this blog of Emmanuel: (all credits to @author Emmanuel Pirsch)&lt;/span&gt;&lt;br /&gt;&lt;a style="font-family: arial;" href="http://epirsch.blogspot.com/2008/02/jna-love-nxt.html"&gt;http://epirsch.blogspot.com/2008/02/jna-love-nxt.html&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;good news for the struggle to get ECLIPSE JAVA and bluetooth together.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Since &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;Emmanuel Pirsch only presented the base of the project, with just an example how start a prog on the brick, we could try out our skills making this in an&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt; ECLIPSE project and making classes for some sensors.&lt;br /&gt;It worked!&lt;br /&gt;&lt;br /&gt;So what did we do?&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;added the exception classes.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;I saw the timeout is used totally to search for devices before starting the program, so i reduced the time-out to 5 seconds, can be probably even less. (The C++ and the C# libs connect within a few seconds if all is well.)&lt;br /&gt;Later on &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;Emmanuel Pirsch suggested the possibility to connect directly to the brick (see his comment) we tried his suggestion and this worked, reducing the waiting time to nearly nothing. (You have to do the search first to get the exact name, after that, you can use this name.)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;I tested this projects and our sketchy classes with HSL homebrew for playing a sound on the brick, the lightsensor (Custom) and the I2C sensors(sonar, clock for the moment). It works!&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;The direct commands must be used without the starting code (which chooses between expecting a response or not, this is indicated in the method.)&lt;br /&gt;Playing a sound uses command 0x03 freq freq duration duration 0x00&lt;br /&gt;Reading a sensor: 0x07 port 0x00 and expecting back a byte[15] (so not the byte[18] of C++)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;table border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;public void playSound(int freq, int duration)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         Status status= new Status();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         ByteBuffer command= ByteBuffer.allocate(6);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         command.put((byte)0x03);//direct command play tone&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         command.put((byte)freq);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         command.put((byte)(freq &gt;&gt;8));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         command.put((byte)duration);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         command.put((byte)(duration&gt;&gt;8));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         command.put((byte)0x00);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, false, command, command.capacity(), null, 0, status);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         System.out.println(status.getStatus().toString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    }&lt;br /&gt;&lt;br /&gt;   public int getBattery()&lt;br /&gt;   {&lt;br /&gt;        Status status= new Status();&lt;br /&gt;        ByteBuffer command= ByteBuffer.allocate(1);&lt;br /&gt;&lt;br /&gt;        command.put((byte)0x0B);//direct command get battery&lt;br /&gt;&lt;br /&gt;        byte[] response = new byte[4]; //this 4 bytes are vital to get the following readings right&lt;br /&gt;      &lt;br /&gt;        fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, true, command, command.capacity(), response, response.length, status);&lt;br /&gt;        return response[0];&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public int readSensor(int port)&lt;br /&gt;{&lt;br /&gt;//used for the lightsensor&lt;br /&gt;Status status= new Status();&lt;br /&gt;ByteBuffer command= ByteBuffer.allocate(3);&lt;br /&gt;&lt;br /&gt;command.put((byte)0x07);//direct command read sensor&lt;br /&gt;command.put((byte)port);&lt;br /&gt;command.put((byte)0x00);&lt;br /&gt;&lt;br /&gt;byte[] response = new byte[15];//expected back&lt;br /&gt;&lt;br /&gt;fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, true, command, command.capacity(), response, response.length, status);&lt;br /&gt;&lt;br /&gt;//the values are not really what they should be at the moment???&lt;br /&gt;int raw=((0xff &amp;amp; response[5]) | (response[6] &lt;&lt; adc="((0xff" best="((0xff" calcu="((0xff"&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;while changing this in the connect method: &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;timeout 5 instead of 30.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;table border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; Pointer iNXTIterator= fantom.nFANTOM100_createNXTIterator(true, &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);font-family:arial;font-size:85%;"  &gt;5&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;, status);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Alternative in case you already have the name available:&lt;br /&gt;In the Fantom &lt;/span&gt;&lt;span style="font-size:85%;"&gt;interface add:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;Pointer nFANTOM100_createNXT(String resourceString, Status status, boolean checkFirmwareVersion);&lt;br /&gt;&lt;br /&gt;Then in the NXT.java class:&lt;br /&gt;&lt;table border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;private Pointer directConnect()throws UnableToCreateNXTException&lt;br /&gt;{&lt;br /&gt;Status status= new Status();&lt;br /&gt;Pointer iNXT = fantom.nFANTOM100_createNXT("BTH::5brickXT::00:16:53:01:BA:74::8", status, false );&lt;br /&gt;&lt;br /&gt;if (Status.Statuses.SUCCESS.equals(status.getStatus())) {&lt;br /&gt;return iNXT;&lt;br /&gt;} else {&lt;br /&gt;throw new UnableToCreateNXTException( " not able to create connection" );&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;and adding the exceptions: (in the package treelaws.mindstorm)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;table border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;package treelaws.mindstorm;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;public class NXTNotFoundException  extends Exception&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    public NXTNotFoundException(final String message) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;     super(message);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;package treelaws.mindstorm;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;public class UnableToCreateNXTException extends Exception&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    public UnableToCreateNXTException(final String message) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;     super( message );&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;then adding the throw in some methods, requiring this:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;table border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;public NXT(String name) throws NXTNotFoundException, UnableToCreateNXTException&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;private Pointer connect(String name) throws NXTNotFoundException, UnableToCreateNXTException&lt;/span&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;and changing the exceptions ( in method connect) to include the message:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;table border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;throw new UnableToCreateNXTException( " not able to create connection" );&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;throw new NXTNotFoundException( " no nxt found" );&lt;/span&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;The lejos in the brick still does not allow a new connection (after having had a connection) it has to be restarted.&lt;br /&gt;&lt;br /&gt;Later on I tested the more complicated I2C sensors: the sonar, and the clock, all went well, here is the class:&lt;br /&gt;&lt;table border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;package treelaws.mindstorm;&lt;br /&gt;&lt;br /&gt;import java.nio.ByteBuffer;&lt;br /&gt;&lt;br /&gt;import com.sun.jna.Pointer;&lt;br /&gt;&lt;br /&gt;import treelaws.fantom.Fantom;&lt;br /&gt;import treelaws.fantom.Status;&lt;br /&gt;&lt;br /&gt;public class I2Csensor {&lt;br /&gt;&lt;br /&gt;private static Fantom fantom = Fantom.INSTANCE;&lt;br /&gt;private Pointer nxtPointer;&lt;br /&gt;int myPort;&lt;br /&gt;String sensorName;&lt;br /&gt;&lt;br /&gt;public I2Csensor (int port, Pointer NXTPointer, String name )&lt;br /&gt;{&lt;br /&gt;myPort = port;&lt;br /&gt;nxtPointer = NXTPointer;&lt;br /&gt;sensorName = name;&lt;br /&gt;setUpI2CSensor();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public int setUpI2CSensor()&lt;br /&gt;{&lt;br /&gt;   //used for the distance, clock, compass, acceleration sensors&lt;br /&gt;    Status status= new Status();&lt;br /&gt;    ByteBuffer command= ByteBuffer.allocate(4);&lt;br /&gt;&lt;br /&gt;    command.put((byte)0x05);//setinputmode&lt;br /&gt;    command.put((byte)myPort);//port&lt;br /&gt;    command.put((byte)0x0B);//sensortype LOWSPEED_9V&lt;br /&gt;    command.put((byte)0x00);//sensormode&lt;br /&gt;&lt;br /&gt;byte[] response = new byte[2];&lt;br /&gt;&lt;br /&gt;fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, true, command, command.capacity(), response, response.length, status);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;return response[0]; //status&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public int getStatusI2CSensor()&lt;br /&gt;{&lt;br /&gt;   //used for the distance&lt;br /&gt;    Status status= new Status();&lt;br /&gt;    ByteBuffer command= ByteBuffer.allocate(2);&lt;br /&gt;&lt;br /&gt;    command.put((byte)0x0E);//setinputmode&lt;br /&gt;    command.put((byte)myPort);//port&lt;br /&gt;&lt;br /&gt;byte[] response = new byte[1];&lt;br /&gt;&lt;br /&gt;fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, true, command, command.capacity(), response, response.length, status);&lt;br /&gt;return response[0]; //number of bytes ready to read&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public int readI2C()&lt;br /&gt;{&lt;br /&gt;int value = -999;&lt;br /&gt;Status status= new Status();&lt;br /&gt;ByteBuffer command= ByteBuffer.allocate(6);&lt;br /&gt;&lt;br /&gt;command.put((byte)0x0F);//LSWRITE&lt;br /&gt;command.put((byte)myPort); //port&lt;br /&gt;command.put((byte)2);//lenght of bytes to send&lt;br /&gt;&lt;br /&gt;if ( sensorName == "sonar" || sensorName == "compass") {   //sonar and compass&lt;br /&gt;command.put((byte)1);//length of bytes to receive sonar&lt;br /&gt;command.put((byte)0x02);//sonar address sonar: 0x02&lt;br /&gt;command.put((byte)0x42);//register to read sonar: 0x42&lt;br /&gt;}&lt;br /&gt;if (  sensorName == "clock" ) {&lt;br /&gt;    command.put((byte)1);//length of bytes to receive&lt;br /&gt;command.put((byte)0xD0);//sonar address clock: 0x02&lt;br /&gt;command.put((byte)0x00);//register to read clock seconds: 0x42&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, false, command, command.capacity(), null, 0,  status);&lt;br /&gt;&lt;br /&gt;int nb = 1; //number of bytes to read&lt;br /&gt;if ( waitI2CSensor( nb) )&lt;br /&gt;    value = readBytesI2CSensor( nb) ;&lt;br /&gt;return value;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;p public int getStatusI2CSensor()&lt;br /&gt;   {&lt;br /&gt;        Status status= new Status();&lt;br /&gt;        ByteBuffer command= ByteBuffer.allocate(2);&lt;br /&gt;&lt;br /&gt;        command.put((byte)0x0E);//setinputmode&lt;br /&gt;        command.put((byte)myPort);//port&lt;br /&gt;&lt;br /&gt;   byte[] response = new byte[1];&lt;br /&gt;&lt;br /&gt;   fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, true, command, command.capacity(), response, response.length, status);&lt;br /&gt;&lt;br /&gt;   return response[0]; //number of bytes ready to read&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public int readI2C()&lt;br /&gt;{&lt;br /&gt;   int value = -999;&lt;br /&gt;   //System.out.println(  "--startread---" + port     );&lt;br /&gt;    Status status= new Status();&lt;br /&gt;    ByteBuffer command= ByteBuffer.allocate(6);&lt;br /&gt;&lt;br /&gt;    command.put((byte)0x0F);//LSWRITE&lt;br /&gt;    command.put((byte)myPort); //port&lt;br /&gt;    command.put((byte)2);//lenght of bytes to send&lt;br /&gt;&lt;br /&gt;    if ( sensorName == "sonar" || sensorName == "compass") {   //sonar and compass&lt;br /&gt;   command.put((byte)1);//length of bytes to receive sonar&lt;br /&gt;    command.put((byte)0x02);//sonar address sonar: 0x02&lt;br /&gt;    command.put((byte)0x42);//register to read sonar: 0x42&lt;br /&gt;    }&lt;br /&gt;    if (  sensorName == "clock" ) {&lt;br /&gt;        command.put((byte)1);//length of bytes to receive&lt;br /&gt;    command.put((byte)0xD0);//address clock: 0xD0&lt;br /&gt;    command.put((byte)0x00);//register to read clock seconds: 0x00 - seconds&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, false, command, command.capacity(), null, 0,  status);&lt;br /&gt;&lt;br /&gt;    int nb = 1; //number of bytes to read&lt;br /&gt;    if ( waitI2CSensor( nb) )&lt;br /&gt;        value = readBytesI2CSensor( nb) ;&lt;br /&gt;   return value;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public boolean waitI2CSensor( int numberBytes)&lt;br /&gt;{&lt;br /&gt;   int nB = getStatusI2CSensor();&lt;br /&gt;   while ( nB &lt; nb =" getStatusI2CSensor();" status=" new" command=" ByteBuffer.allocate(4);" response =" new" sensorname ="=" a =" response[3]"&gt;&gt;4) *6;//otherwise the number of seconds will be jumping&lt;br /&gt;     System.out.println("clock " +  response[0] + " " +  response[1] + " " +  response[2] + " "+  response[3] + " " + response[4]+ " " + response[5]+ " " + response[6]);&lt;br /&gt;      return a;&lt;br /&gt;  }&lt;br /&gt;  if ( sensorName == "sonar" || sensorName == "compass") {&lt;br /&gt;&lt;br /&gt;          return  0xff &amp;amp; response[3]; }    //value read, starting from 5&lt;br /&gt;  return -999;//no known sensor&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Remark: using this constructor to make instances for the compass and the sonar sensor, using the above example, somehow these two sensors seem to "switch" values. hmmmmmmmmm...:-)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;To make a map of the surroundings, we also need a motor class, a sketch using the tacholimit:&lt;br /&gt;&lt;table border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;package treelaws.mindstorm;&lt;br /&gt;&lt;br /&gt;import com.sun.jna.Pointer;&lt;br /&gt;import java.nio.ByteBuffer;&lt;br /&gt;&lt;br /&gt;import treelaws.fantom.*;&lt;br /&gt;import treelaws.fantom.Status;&lt;br /&gt;&lt;br /&gt;public class motor {&lt;br /&gt;&lt;br /&gt;private static Fantom fantom = Fantom.INSTANCE;&lt;br /&gt;private Pointer nxtPointer;&lt;br /&gt;private int motorPort;&lt;br /&gt;&lt;br /&gt;int MOTORON = 0x01;&lt;br /&gt;int BRAKE = 0x02;&lt;br /&gt;int REGULATED = 0x04;&lt;br /&gt;&lt;br /&gt;int REGULATION_MODE_IDLE = 0x00;&lt;br /&gt;int REGULATION_MODE_MOTOR_SPEED = 0x01;&lt;br /&gt;int REGULATION_MODE_MOTOR_SYNC = 0x02;&lt;br /&gt;&lt;br /&gt;int MOTOR_RUN_STATE_IDLE = 0x00;&lt;br /&gt;int MOTOR_RUN_STATE_RAMPUP = 0x10;&lt;br /&gt;int MOTOR_RUN_STATE_RUNNING = 0x20;&lt;br /&gt;int MOTOR_RUN_STATE_RAMPDOWN = 0x40;&lt;br /&gt;&lt;br /&gt;public motor (int port, Pointer NXTPointer)&lt;br /&gt;{&lt;br /&gt;motorPort = port;&lt;br /&gt;nxtPointer = NXTPointer;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void reset()&lt;br /&gt;{&lt;br /&gt;Status status= new Status();&lt;br /&gt;   ByteBuffer command= ByteBuffer.allocate(2);&lt;br /&gt;&lt;br /&gt;   command.put((byte)0x0A);//reset&lt;br /&gt;   command.put((byte)motorPort);//port&lt;br /&gt;&lt;br /&gt;   fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, false, command, command.capacity(), null, 0, status);&lt;br /&gt;   System.out.println("reset" + " " + status.code);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void speedMotor( int power, int turnratio)&lt;br /&gt;{&lt;br /&gt;Status status= new Status();&lt;br /&gt;ByteBuffer command= ByteBuffer.allocate(13);&lt;br /&gt;&lt;br /&gt;command.put((byte)0x04);//LSREAD&lt;br /&gt;command.put((byte)motorPort);//port&lt;br /&gt;command.put((byte)power);//power -100 - 100&lt;br /&gt;command.put((byte)MOTORON );//mode&lt;br /&gt;command.put((byte)REGULATION_MODE_MOTOR_SYNC );//regulation synchronized&lt;br /&gt;command.put((byte)(128 - turnratio) );//turnratio&lt;br /&gt;command.put((byte)REGULATION_MODE_MOTOR_SPEED );//runstate&lt;br /&gt;command.put((byte)0x50 );//tacholimit = 0&lt;br /&gt;command.put((byte)0x00 );//tacholimit = 0&gt;&gt; 8&lt;br /&gt;command.put((byte)0x00 );//tacholimit = 0&gt;&gt; 16&lt;br /&gt;command.put( (byte)0x00 );//tacholimit = 0&gt;&gt; 24&lt;br /&gt;command.put( (byte)0x00 );//tacholimit = 0&gt;&gt; 32&lt;br /&gt;command.put( (byte)0x00 );//closing&lt;br /&gt;&lt;br /&gt;fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, false, command, command.capacity(), null, 0, status);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void stopMotor()&lt;br /&gt;{&lt;br /&gt;Status status= new Status();&lt;br /&gt;ByteBuffer command= ByteBuffer.allocate(12);&lt;br /&gt;&lt;br /&gt;command.put((byte)0x04);//LSREAD&lt;br /&gt;command.put((byte)motorPort);//port&lt;br /&gt;command.put((byte)0x00);//power -100 - 100&lt;br /&gt;command.put( (byte)REGULATED );//mode&lt;br /&gt;command.put( (byte)REGULATION_MODE_MOTOR_SYNC );//regulation&lt;br /&gt;command.put( (byte)0x00 );//turnratio&lt;br /&gt;command.put( (byte)MOTOR_RUN_STATE_IDLE );//runstate&lt;br /&gt;command.put( (byte)0x00 );//tacholimit = 0&lt;br /&gt;command.put( (byte)0x00 );//tacholimit = 0&lt;br /&gt;command.put( (byte)0x00 );//tacholimit = 0&lt;br /&gt;command.put( (byte)0x00 );//tacholimit = 0&lt;br /&gt;command.put( (byte)0x00 );//tacholimit = 0&lt;br /&gt;&lt;br /&gt;fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, false, command, command.capacity(), null, 0, status);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Jq__kevBr8s/R_SbPUSAVkI/AAAAAAAAAxI/LGNtwzZBnek/s1600-h/radartry.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://4.bp.blogspot.com/_Jq__kevBr8s/R_SbPUSAVkI/AAAAAAAAAxI/LGNtwzZBnek/s320/radartry.jpg" alt="" id="BLOGGER_PHOTO_ID_5184939758454855234" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;With a bit of JAVA Graphic, i got this result, NXT scanning for objects, using compass and sonar, some strange effects have to be investigated,&lt;br /&gt;some other effects are resulting from the sonar, which is not a straightforward linear razorsharp distance device!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Connection setup XP or VISTA (tested for both)&lt;br /&gt;Needed:&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;installing NXT Mindstorms CD (this installs the fantom lib)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;bluetooth dongle&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt;make a project, install all the classes given in the referenced blog of Emmanuel Pirsch, (include your own classes or use the classes sketched here)&lt;br /&gt;You have to install a comport:&lt;br /&gt;In bluetooth manager Search for device&lt;br /&gt;Wizard, manual key 1234&lt;br /&gt;ready with wizard&lt;br /&gt;first use connect method in the JAVA project with search for device&lt;br /&gt;copy name of brick BTH::name of device::Mac-address::comport&lt;br /&gt;then you can switch to directConnect&lt;br /&gt;&lt;br /&gt;Troubleshooting:&lt;br /&gt;After having worked with a fantom lib project yesterday, today it won't connect!&lt;br /&gt;I had to redo the COMPORT settings. Desinstall existing COMPORTS, do a search, give the preconfigured key, check the ports again.&lt;br /&gt;Possible cause: the Brick was running from my laptop on XP, and Michel tested it from VISTA. This might have reconfigured the brick???&lt;br /&gt;&lt;br /&gt;Big problem with the fantom lib or this kind of interface: writing commands does not seem to be working.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;(see solution...:-(       )&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;LSWRITE is ok to check registers, reading values etc, but LSWRITE to the command register with a command has no effect. Testing for several I2C sensors, compaas, camera, and clock. The clock has a RAM, which can be written to using C++ (my own classes in the Anders lib).&lt;br /&gt;This is the code:&lt;br /&gt;&lt;br /&gt;   public void sendCommand(byte cmd)&lt;br /&gt;   {&lt;br /&gt;       System.out.println(" sendCommand " + cmd);&lt;br /&gt;       Status status= new Status();&lt;br /&gt;       ByteBuffer command= ByteBuffer.allocate(7);&lt;br /&gt;&lt;br /&gt;       command.put((byte)0x0F);//LSWRITE&lt;br /&gt;       command.put((byte)myPort); //port&lt;br /&gt;       command.put((byte)3);//length of bytes to send&lt;br /&gt;&lt;br /&gt;        command.put((byte)0);//length of bytes to receive camera&lt;br /&gt;        command.put((byte)0x02);//camera address camera: 0x02&lt;br /&gt;        command.put((byte)0x41);//command address&lt;br /&gt;        command.put((byte)cmd);//command byte to send&lt;br /&gt;     &lt;br /&gt;      fantom.nFANTOM100_iNXT_sendDirectCommand(nxtPointer, false, command, command.capacity(), null, 0, status);&lt;br /&gt;       System.out.println( "sendcommand back: " + nb + " char= " + cmd + "   " + myPort    ) ;&lt;br /&gt;       pause(100); //should check I2C status&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;This means that reading values from the usual &lt;/span&gt;&lt;span style="font-size:85%;"&gt; I2C  &lt;/span&gt;&lt;span style="font-size:85%;"&gt;sensors is possible (Compass, Clock, Tilt for instance) but no changes can be made, nor the camera can be put in the following objects mode.&lt;br /&gt;&lt;br /&gt;Solution: the bluetooth connection is on a master- slave basis which means that writing registers is not possible. So reading from sensors is ok, but starting the camera, or setting the time in the clock sensor is not possible.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;reference:&lt;br /&gt;&lt;a href="http://nxtasy.org/2006/12/23/fantomtalk/"&gt;http://nxtasy.org/2006/12/23/fantomtalk/&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;a title="This external link will open in a new window" href="http://mindstorms.lego.com/Overview/NXTreme.aspx" target="_new"&gt;http://mindstorms.lego.com/Overview/NXTreme.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-8763237508522610308?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/8763237508522610308/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=8763237508522610308' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/8763237508522610308'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/8763237508522610308'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/03/fantom-api-and-java.html' title='fantom API and JAVA'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Jq__kevBr8s/R_SbPUSAVkI/AAAAAAAAAxI/LGNtwzZBnek/s72-c/radartry.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-1784464060869331437</id><published>2008-03-24T03:47:00.000-07:00</published><updated>2008-04-19T10:14:45.239-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sites'/><category scheme='http://www.blogger.com/atom/ns#' term='ideas'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>sites and ideas</title><content type='html'>Here a list of sites i found, which contain all kind of ideas and info:&lt;br /&gt;&lt;br /&gt;latest:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.juanantonio.info/p_articles/archive/2008/LEJOS-NXJ-EBOOK.pdf"&gt;ebook by Juan Antonio Brena Moral, excellent!&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;general&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.crynwr.com/lego-robotics/"&gt;http://www.crynwr.com/lego-robotics/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.tau.ac.il/%7Estoledo/lego/"&gt;http://www.tau.ac.il/%7Estoledo/lego/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.motocube.com/index.php?option=com_content&amp;amp;task=blogsection&amp;amp;id=5&amp;amp;Itemid=28"&gt;http://www.motocube.com/index.php?option=com_content&amp;amp;task=blogsection&amp;amp;id=5&amp;amp;Itemid=28&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://philohome.com/nxtpwr/pwr.htm"&gt;http://philohome.com/nxtpwr/pwr.htm&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;bluetooth/direct commands&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://epirsch.blogspot.com/2008/02/jna-love-nxt.html"&gt;http://epirsch.blogspot.com/2008/02/jna-love-nxt.html&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.tau.ac.il/%7Estoledo/lego/btperformance.html"&gt;http://www.tau.ac.il/~stoledo/lego/btperformance.html&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://nxtemplar.blogspot.com/2006/10/bluetooth-nxt-robotics-studio.html"&gt;http://nxtemplar.blogspot.com/2006/10/bluetooth-nxt-robotics-studio.html&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a style="font-weight: bold; font-family: arial; color: rgb(255, 0, 0);" href="http://epirsch.blogspot.com/2008/02/jna-love-nxt.html"&gt;http://epirsch.blogspot.com/2008/02/jna-love-nxt.html&lt;/a&gt; (using the fantom API)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;radar project&lt;br /&gt;&lt;ul&gt;&lt;li&gt;   &lt;a href="http://www.juanantonio.info/jab_cms.php?id=93"&gt;http://www.juanantonio.info/jab_cms.php?id=93&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;ideas for models:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://ricquin.net/lego/instructions/"&gt;http://ricquin.net/lego/instructions/&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-1784464060869331437?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/1784464060869331437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=1784464060869331437' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/1784464060869331437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/1784464060869331437'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/03/sites-and-ideas.html' title='sites and ideas'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-8013816834615735054</id><published>2008-03-02T07:15:00.000-08:00</published><updated>2008-12-10T02:07:52.419-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='radar'/><category scheme='http://www.blogger.com/atom/ns#' term='map'/><category scheme='http://www.blogger.com/atom/ns#' term='clock sensor'/><category scheme='http://www.blogger.com/atom/ns#' term='sonar'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>NXT mapping radar</title><content type='html'>&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;br /&gt;The sonar sensor of the NXT can measure the distance to objects. So this sensor can make a map of the surroundings of the brick.&lt;br /&gt;To make a map the sonar needs to be turned around 360 degrees, while measuring the distance of the objects. Because the sensor needs to be attached with the cord, this turning is most easily done by rotating the whole brick, with its wheels. These wheels can provide a measure for the angle rotated, if you don't have a compass sensor.&lt;br /&gt;&lt;br /&gt;Then the data need to be analyzed. Writing a file from a C++ prog (with bluetooth conenction to the NXT, steering it around its axis too) is really easy:&lt;br /&gt;add some headers:&lt;br /&gt;&lt;br /&gt; #include &lt;fstream&gt;&lt;fstream&gt;&lt;br /&gt;&lt;br /&gt;ofstream out1;&lt;br /&gt;out1.open("result.txt",ios::app);&lt;br /&gt;//in the while loop:&lt;br /&gt;out1 &lt;&lt;  motorD &lt;&lt; "***"&lt;&lt;    sonarD &lt;&lt; "***"&lt;&lt;   endl;&lt;br /&gt;//writing "***" between the values, to get a nice split of the string into an array&lt;br /&gt;//and close it after stopping the measurements:&lt;br /&gt;out1.close(); &lt;br /&gt;&lt;br /&gt;Then you have a textfile, how to unwrap the data into a map? For the moment I used FLASH CS3 for this. It can be done with OpenGL too.  In the FLASH the data are loaded and the string is split into an array using the "a"'a between the values. Then the angle (coming from the motor sensor) is used to put the dots (from the sonar) at the indicated distance from the NXT, using a bit of mathematic, sine and cosine:  abstract: (can be used like this everywhere) centre: 300,200 ff: scale factor for the radius = distance from the centre results: array containing angle1, distance1, angle2, distance2, etc Math.PI/180 : needed to get from degrees to radians so a point becomes: (300 -  ff*  results[i+1]*Math.sin(-results[i] * Math.PI/180 ), 200 + - ff* results[i+1]*Math.cos(results[i] * Math.PI/180 )) Actually this is going from rectangular to "polar" coordinates, turning a rectangle around a point. There is a filter of this in Photoshop, quite fun to play with it, in 17th century art, painters were doing this trick making paintings which could only be seen through a circular mirror wrapped around a stick! They called this anamorphoses... &lt;/fstream&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Jq__kevBr8s/R8rIiCb1IpI/AAAAAAAAAvk/avecqwjrFxk/s1600-h/obstacle.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 578px; height: 217px;" src="http://2.bp.blogspot.com/_Jq__kevBr8s/R8rIiCb1IpI/AAAAAAAAAvk/avecqwjrFxk/s320/obstacle.jpg" alt="" id="BLOGGER_PHOTO_ID_5173167609083142802" border="0" /&gt;&lt;/a&gt;&lt;fstream&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In the picture you see the result: the test environment and the dots.&lt;br /&gt;You can observe that the sonar sees slightly "bigger" objects then the objects we see. Also the rounded object can pose a problem, the sonar works with signals reflected from the object, so how does he see this circle? The NXT was going around several times before this image was built.&lt;br /&gt;Some more experiments are needed with different materials and shapes to get a real notion of his viewing capabilities.&lt;br /&gt;&lt;br /&gt;The next step is to steer to another position, make a second map, and trying to relate these two maps.&lt;br /&gt;&lt;br /&gt;work in progress!&lt;br /&gt;&lt;br /&gt;//-----------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;When I found the f&lt;a href="http://nxt-adventures.blogspot.com/2008/03/fantom-api-and-java.html"&gt;antom Lib possibilities  &lt;/a&gt;the map could be made immediately using the bluetooth JAVA connection.&lt;br /&gt;The I2C sensors and the DIRECT COMMANDS cuased some problems but in the end it worked, using the compass and the sonar sensor.&lt;br /&gt;&lt;br /&gt;The compass sensor has to be very horizontal, otherwise the degrees do not cover the circle evenly, as can be seen in the picture in the fantom lib blog.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/fstream&gt;&lt;br /&gt;&lt;fstream&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/fstream&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-8013816834615735054?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/8013816834615735054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=8013816834615735054' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/8013816834615735054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/8013816834615735054'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/03/nxt-mapping-radar.html' title='NXT mapping radar'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Jq__kevBr8s/R8rIiCb1IpI/AAAAAAAAAvk/avecqwjrFxk/s72-c/obstacle.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-8896852009743962968</id><published>2008-03-01T04:55:00.000-08:00</published><updated>2008-04-19T08:28:10.427-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Direct Commands'/><category scheme='http://www.blogger.com/atom/ns#' term='clock sensor'/><category scheme='http://www.blogger.com/atom/ns#' term='I2CSensor'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>Direct Commands using Bluetooth, I2C</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;Direct commands are bits of code send through Bluetooth to the NXT.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;You can control all the functions of the NXT using the direct commands, and the JAVA and C++ and C# libs using the bluetooth/COMPort are built on these commands.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Using the different libraries which are available, the Direct Commands are hidden in the objects for instance the sonar is based on the I2C class, which uses Direct Commands.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;So in the Bram Fokke, the Anders and the Lejos libraries, the ones I studied, because they are free, the Direct Commands are hidden in the classes. (The fantom lib found later allowed us to built our own library.)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;But then you encounter a sensor which was not there in the time they wrote their classes and this sensor just doesn't behave like the sensor types they have provided for. Then suddenly you have to study the Direct Commands.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;In principle not very difficult and there is the documentation of the Bluetooth Developers Kit of Lego: &lt;/span&gt;&lt;a style="font-family: arial;" href="http://mindstorms.lego.com/Overview/NXTreme.aspx"&gt;http://mindstorms.lego.com/Overview/NXTreme.aspx&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;In principle you can find your way with these docs.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;I was especially interested in the control of the I2C clock sensor.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;The only reference about these sensors I eventually found on the web is:&lt;/span&gt;&lt;br /&gt;&lt;a style="font-family: arial;" href="http://hsrc.static.net/Research/NXT%20I2C%20Communication/"&gt;http://hsrc.static.net/Research/NXT%20I2C%20Communication/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Details:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul  style="font-family:arial;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;the first two bits are sometimes included sometimes hidden (length of command)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;the LSREAD in the mindstorm pdf has a mistake: it is 21 bytes long (or 24), the rx length from 4-21, Anders lib 24 bytes.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;what comes back can be status included, or not (fantom lib)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;the setup of a sensor (I2C) produces a lot of bytes which should be discarded&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;the commands responses must be all taken care of! One byte in between, not read will mesh everything up!&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;But even the last doc of the links was not really clear to me, missing the two first Bytes to write!&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;So here some examples, building on this page:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;As written above these three commands are used:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;       &lt;p class="MsoNormal"  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;LSWRITE is used for both reading registers and writing commands from the NXT.&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;LSGETSTATUS is used basically to wait until the i2c bus is free.&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;LSREAD will read any bytes that the NXT has received from the i2c device.&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;First in the row of commands are two bytes: the total length LSB and the same MSB&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;(so the second byte is always 0! In some libes these 2 bytes are integrated differently!)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Then you can follow this last doclink:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;send(&amp;amp;command[0],7); replaces LSWRITE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;sensor.read() does the LSREAD&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;sensor.wait_ans(nr) waits for nr bytes, using the LSGETSTATUS and a timer&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;(to be found in the Lib of Anders)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;for instance: play a tone: (C++ lib of Anders)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;char command[10];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        //---------------------------------------------playtone&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[0]=0x06;//length LSB&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[1]=0x00;//length MSB&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[2]=0x00;//do not bother to send anything back (0x80 when something is expected back)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[3]=0x03;//play tone&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        int freq = 4000;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[4]=freq;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[5]=freq &gt;&gt;8;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        int time = 100;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[6]=time;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[7]=time&gt;&gt;8;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[8]=0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        comport-&gt;send(&amp;amp;command[0],8);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;//----------------------------------------------------end playtone----&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;example 2: set output state of a sensor:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  command[0]=5;//total length&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[1]=0x00;//second byte of the length&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[2]=0x80; //0x00 would block the measurements because sending something&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[3]=0x05;//setinputmode command&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[4]=0x00;//port of the sensor on the brick NXT&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[5]=0x0A;//constant for type of sensor&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[6]=0x00;//sensormode&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        comport-&gt;send(&amp;amp;command[0],7);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        if(sensor.wait_ans(4)){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;            answer=sensor.read();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;//---------end set output state&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;example 3 reading a register of an I2C sensor&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;char command[9];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[0]=7;//total length&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[1]=0x00;//total length&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[2]=0x80;//expect something back&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[3]=0x0F;//LSWRITE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[4]=0x00; //port&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[5]=2;//lenght of bytes to send&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[6]=1;//length of bytes to receive&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[7]=CLOCK_ADDRESS; //i2c address of the clock&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[8]=reg_adr;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        comport-&gt;send(&amp;amp;command[0],9);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        char *answer;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;       if(sensor.wait_ans(1)){ //and wait for the one byte back&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;            answer=sensor.read();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;            return  answer[1] ; //reading this was using not the answer[0], but this depends on the sensor&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;//------------------------end reading a register&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;example 4: writing to e register, that is copy the last one, but add one register after this commandList:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;char command[10];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[0]=8;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[1]=0x00;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[2]=0x80;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[3]=0x0F;//LSWRITE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[4]=0x00; //port&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[5]=3;//lenght of bytes to send&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[6]=1;//length of bytes to receive&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[7]=CLOCK_ADDRESS; //i2c address&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[8]=reg_adr;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        command[9]=val; //thus giving the value you want to give this register&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        comport-&gt;send(&amp;amp;command[0],10);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        char *answer;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;       if(sensor.wait_ans(1)){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;            answer=sensor.read();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;            return  answer[1] ; //again, the reading back of the response has to be looked at, depending on sensor&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;//end ----------------------------------------------------reading a register&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;With these direct commands, the &lt;/span&gt;&lt;a style="font-family: arial;" href="http://nxt-adventures.blogspot.com/2008/02/clock-sensor.html"&gt;Dev - Cpp classes&lt;/a&gt;&lt;span style="font-family:arial;"&gt; for the clock sensor were built.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;See the blog: &lt;/span&gt;&lt;a style="font-family: arial;" href="http://nxt-adventures.blogspot.com/2008/04/trying-to-make-sense-of-i2c-setup.html"&gt;I2C setup&lt;/a&gt;&lt;span style="font-family:arial;"&gt; to see more details (and problems), using the fantom lib&lt;br /&gt;&lt;br /&gt;Limits: using DIRECT COMMANDS from the PC, you cannot set registers on sensors, due to the master slave relation, &lt;a href="http://nxt-adventures.blogspot.com/2008/04/master-slave.html"&gt;see master slave blog&lt;/a&gt;.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;                     &lt;p class="MsoNormal"  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-8896852009743962968?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/8896852009743962968/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=8896852009743962968' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/8896852009743962968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/8896852009743962968'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/03/direct-commands-using-bluetooth-i2c.html' title='Direct Commands using Bluetooth, I2C'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-7108968588773942576</id><published>2008-02-29T10:23:00.000-08:00</published><updated>2008-03-01T04:54:03.194-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Dev Cpp'/><category scheme='http://www.blogger.com/atom/ns#' term='sensoren'/><category scheme='http://www.blogger.com/atom/ns#' term='clock'/><category scheme='http://www.blogger.com/atom/ns#' term='classes'/><category scheme='http://www.blogger.com/atom/ns#' term='time'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>clock sensor</title><content type='html'>&lt;span style=";font-family:arial;font-size:85%;"  &gt;Having bought the Acceleration sensor, mindsensors.com send me the clock sensor. So they have sent me the acceleration sensor and let me keep the clock sensor.&lt;br /&gt;&lt;br /&gt;This clock sensor comes with a block for the Lego FIRMWARE, which worked fine, displaying time and date.&lt;br /&gt;Then i wanted to implement the sensor in C# for the measuring of the time the various sensors use. Although i can use sustem time for this I wanted to make use of another sensor and learn something about it.&lt;br /&gt;The sensorclass wasn't to easy to build! So back to Lejos Java. In this language the same problem. This was not as easyas the  acceleration sensor.&lt;br /&gt;So back to Dev Cpp, with the library of Anders, which is very clear to understand. I had to study the direct commands more closely, and constructed my own direct commands sequences, learning a lot about this.&lt;br /&gt;&lt;br /&gt;Eevntually the Dev-Cpp classes for the clock started working.&lt;br /&gt;The Datasheet provided by mindsensors.com has all the necessary informations, but....you have to read carefully!&lt;br /&gt;&lt;br /&gt;Having made these classes, i'll construct the Lejos Java, and the C# classes. But that is for later.&lt;br /&gt;&lt;br /&gt;First these classes, which can be downloaded. First Version: be careful!&lt;br /&gt;&lt;a href="http://www.contrechoc.com/nxt/Clock%20DevCpp.zip"&gt;NXT clock classes&lt;/a&gt;&lt;br /&gt;To be used with the&lt;a href="http://www.norgesgade14.dk/bluetoothlibrary.php"&gt; lib of Anders&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;more versions will follow, for the Lejos, and the C3 lib of Bram Fokke.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;iostream&gt;&lt;string&gt;&lt;iostream&gt;&lt;stdio.h&gt;&lt;time.h&gt;&lt;string&gt;&lt;stdlib.h&gt;&lt;cstdlib&gt;&lt;string&gt;&lt;conio.h&gt;&lt;/conio.h&gt;&lt;/string&gt;&lt;/cstdlib&gt;&lt;/stdlib.h&gt;&lt;/string&gt;&lt;/time.h&gt;&lt;/stdio.h&gt;&lt;/iostream&gt;&lt;/string&gt;&lt;/iostream&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-7108968588773942576?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/7108968588773942576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=7108968588773942576' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7108968588773942576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7108968588773942576'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/02/clock-sensor.html' title='clock sensor'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-146798971612916700</id><published>2008-02-27T12:32:00.000-08:00</published><updated>2008-03-12T13:25:47.173-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='long'/><category scheme='http://www.blogger.com/atom/ns#' term='lejos'/><category scheme='http://www.blogger.com/atom/ns#' term='clock sensor'/><category scheme='http://www.blogger.com/atom/ns#' term='I2CSensor'/><title type='text'>I2C sensor, lejos clock sensor class</title><content type='html'>I2Csensor, abstract class, wiring, solution reading clock sensor in lejos&lt;br /&gt;&lt;br /&gt;This type of sensor is different from the custom sensors like the light, the touch and the sound.&lt;br /&gt;&lt;br /&gt;First of all very handy is this site:&lt;br /&gt;&lt;a href="http://www.koders.com/info.aspx?c=ProjectInfo&amp;amp;pid=RHGY8H3PWYCG28MNNNS8V1BLGC"&gt;http://www.koders.com/info.aspx?c=ProjectInfo&amp;amp;pid=RHGY8H3PWYCG28MNNNS8V1BLGC&lt;/a&gt;&lt;br /&gt;where all the classes are shown.&lt;br /&gt;These class can be found in the lejos folder too: lejos_nxj/src/java/classes as textfiles, but the Koders is handy, it has a search.&lt;br /&gt;&lt;br /&gt;You can see that the I2Csensor class is an abstract class: you have to use the super() as a constructor:&lt;br /&gt;&lt;br /&gt;//------------------------------------------------------------&lt;br /&gt;//    I2Csensor class&lt;br /&gt;//------------------------------------------------------------&lt;br /&gt;For instance you can see how to write a class for an I2Csensor which is not in the list (i did the clock), see on Koders how it is done with the tilt sensor.&lt;br /&gt;&lt;br /&gt;import lejos.nxt.*;&lt;br /&gt;public class clock extends I2CSensor&lt;br /&gt;{&lt;br /&gt;  byte[] buf = new byte[2];&lt;br /&gt;&lt;br /&gt;  public clock(SensorPort port)&lt;br /&gt;  {&lt;br /&gt;      super(port);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public int getByte(byte myByte)&lt;br /&gt;  {&lt;br /&gt;      int ret = getData(myByte, buf, 1);&lt;br /&gt;      return ret;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Then continuing trying to get the clocksensor to work under lejos JAVA, (it works in Dev Cpp).&lt;br /&gt;i found this bit of important information:&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;The sensor ports have two channels to them:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;1) Analog channel. These are read with the raw value. This is used to &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;read devices like the light sensor and push button and other resistive &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;sensors.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;2) Digital wires. These can be used as inputs or outputs. On the light sensor &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;they are used to turn the LED on or off. Thay also can be used to make an I2C &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;port which can be used to communicate with a compass sensor or ultrasonic &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;sensor.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;Note!!! I2C only works with port 1.. port 3 at the moment. There is something &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;wrong with trying to use it on port 4 at present, but this is being debugged.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;So, trying to use the raw reading method for an I2C sensor does not even look &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;at the correct wires on the port.&lt;br /&gt;&lt;/span&gt;&lt;span class="sender"&gt;(by Charles Manning)&lt;br /&gt;&lt;br /&gt;But that is not the way to proceed.&lt;br /&gt;The problem is the getData.&lt;br /&gt;This method used i2cStart( address, register, len, buf, len, 0);&lt;br /&gt;where the address is written in the I2Csensor class as 1.&lt;br /&gt;Actually this int 1 is shifted in the lowlevel routine (written in C, can also be&lt;br /&gt;found in the lejos folder:  &lt;/span&gt;lejos_nxj/src/nxtvm\platform\nxt : i2c.c , in C)&lt;br /&gt;This address is the what is called the factory address. But for the tilt and compass sensors this is 0x02.&lt;br /&gt;The clocksensor has a factory address 0xD0.&lt;br /&gt;All a bit mysterious, till I made the link: in the lejos JAVA I2C sensor class the factory setting is shifted,&lt;br /&gt;to become 1: 2&gt;&gt;1 = 1.&lt;br /&gt;So trying: 0xD0&gt;&gt;1 = 0xD0/2 (as address) worked in the &lt;span&gt;&lt;span class="sender"&gt;i2cStart method.&lt;br /&gt;&lt;br /&gt;I wrote a method for the clock sensor oerriding the getData in the I2C class.&lt;br /&gt;&lt;br /&gt;public int getData(int register, byte [] buf, int len) { &lt;br /&gt;  int ret = myPort.i2cStart(0xD0 / 2, register, len, buf, len, 0);&lt;br /&gt;  if (ret != 0) return ret;&lt;br /&gt;  while (myPort.i2cBusy() != 0) {&lt;br /&gt;   Thread.yield();&lt;br /&gt;  }&lt;br /&gt;  return 0;&lt;br /&gt; }&lt;br /&gt;then you can use the data provided by the mindsensor pdf:&lt;br /&gt;&lt;br /&gt;public int rawSec()&lt;br /&gt; {&lt;br /&gt;  int ret = getData(0x00, buf, 1);&lt;br /&gt;  return (ret == 0 ? (buf[0]  ) : -1);&lt;br /&gt; }&lt;br /&gt; public int rawMin()&lt;br /&gt; {&lt;br /&gt;  int ret = getData(0x01, buf, 1);&lt;br /&gt;  return (ret == 0 ? (buf[0]  ) : -1);&lt;br /&gt; }&lt;br /&gt; public int rawHoures()&lt;br /&gt; {&lt;br /&gt;  int ret =  getData(0x02, buf, 1);&lt;br /&gt;  return (ret == 0 ? (buf[0]  ) : -1);&lt;br /&gt; }&lt;br /&gt;etc, why "rawSec", because of the byte structure:&lt;br /&gt;(see clock sensor pdf)&lt;br /&gt;&lt;br /&gt;public int getSec()&lt;br /&gt; {&lt;br /&gt;  int a = rawSec();&lt;br /&gt;  return a - (a&gt;&gt;4) *6; &lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; public int getMin()&lt;br /&gt; {&lt;br /&gt;  int a = rawHoures();&lt;br /&gt;  return a - (a&gt;&gt;4) *6;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;etc gives the right seconds.....&lt;br /&gt;&lt;br /&gt;The clocksensor class will be available here soon for download.&lt;br /&gt;&lt;br /&gt;//------------------------------------------------------------&lt;br /&gt;//    long in Lejos?&lt;br /&gt;//------------------------------------------------------------&lt;br /&gt;You can get a time in milliseconds on the NXT. I used it for measuring the responsetime of the sensors. This is given in: long currentTimeMillis()&lt;br /&gt;But adding arithmetical operations are not supported in the Lejos Java (told Eclipse).&lt;br /&gt;So what to do?&lt;br /&gt;This was my solution:&lt;br /&gt;before the measurments&lt;br /&gt;double startTime= (double) System.currentTimeMillis();&lt;br /&gt;after:&lt;br /&gt;double nowTime =  (double)System.currentTimeMillis() ;&lt;br /&gt;int now =  (int)(( nowTime - startTime)/1000);&lt;br /&gt;LCD.drawInt( now ,0,5) ;&lt;br /&gt;LCD.refresh();&lt;br /&gt;Mind also the System before the currentTimeMillis();!&lt;br /&gt;&lt;br /&gt;//--------------------------------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-146798971612916700?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/146798971612916700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=146798971612916700' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/146798971612916700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/146798971612916700'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/02/nxt-and-lejos-fun.html' title='I2C sensor, lejos clock sensor class'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-7884403394210620320</id><published>2008-02-19T00:39:00.000-08:00</published><updated>2008-12-10T02:07:53.031-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='building'/><category scheme='http://www.blogger.com/atom/ns#' term='gearbox'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>The gearbox of Jos</title><content type='html'>In the standard box of the NXT there are three motors. Also on the brick itself there are three plugs for motors. So three sources of power are provided for, very basic as it turns out.&lt;br /&gt;In the car mode:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Jq__kevBr8s/R7qbxT7T4XI/AAAAAAAAAts/PqVI2wq6g6c/s1600-h/cog.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://1.bp.blogspot.com/_Jq__kevBr8s/R7qbxT7T4XI/AAAAAAAAAts/PqVI2wq6g6c/s320/cog.jpg" alt="" id="BLOGGER_PHOTO_ID_5168614793826001266" border="0" /&gt;&lt;/a&gt;Steering and driving takes two, (whatever the construction) so one motor is left for doing something, grabbing a ball, lifting a peddle, or turning the sonar around.&lt;br /&gt;In the crane mode:&lt;br /&gt;turning, lifting and grabbing.&lt;br /&gt;&lt;br /&gt;You wonder if it could be possible to do more. (That is without simply buying more motors and putting in some wiring to get these running on the three plugs.)&lt;br /&gt;Is there another possibility?&lt;br /&gt;There is this wonderful complicated piece in the set, having inner and outer cogwheel teeth. It is used in the crane, described on the Lego CD.&lt;br /&gt;This double cogwheel really inspires fantasies about spaces filled with gears and shifting components, clicking and humming and working and producing and……&lt;br /&gt;&lt;br /&gt;The idea of a gearbox spring to mind!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Suddenly Jos made a drawing like a Leonardo da Vinci and got to work. He constructed a complicated little, watch like device, which has the possibility of shifting a cogwheel to several other cogwheels. In principle two motors can steer a whole set of activities. This gearbox has to be built in the total Lego structure, which will be another little challenge.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Jq__kevBr8s/R7qcxj7T4aI/AAAAAAAAAuE/7Nbn5exeedM/s1600-h/draw.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_Jq__kevBr8s/R7qcxj7T4aI/AAAAAAAAAuE/7Nbn5exeedM/s320/draw.jpg" alt="" id="BLOGGER_PHOTO_ID_5168615897632596386" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now it gets to real engineering and you could possible understand why all the cranks, bolts and screws you need to turn are so difficult to reach in cars :-)……&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Jq__kevBr8s/R7qcrz7T4ZI/AAAAAAAAAt8/tfnCLZIsoR8/s1600-h/gear.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://3.bp.blogspot.com/_Jq__kevBr8s/R7qcrz7T4ZI/AAAAAAAAAt8/tfnCLZIsoR8/s320/gear.jpg" alt="" id="BLOGGER_PHOTO_ID_5168615798848348562" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And a model i came across by accident using this phantastic piece in a creative way is the  hopper:&lt;br /&gt;&lt;a href="http://ricquin.net/lego/instructions/hopper.htm"&gt;http://ricquin.net/lego/instructions/hopper.htm&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-7884403394210620320?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/7884403394210620320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=7884403394210620320' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7884403394210620320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7884403394210620320'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/02/gearbox-of-jos.html' title='The gearbox of Jos'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Jq__kevBr8s/R7qbxT7T4XI/AAAAAAAAAts/PqVI2wq6g6c/s72-c/cog.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-3345375279842671621</id><published>2008-02-08T05:38:00.000-08:00</published><updated>2008-12-10T02:07:53.938-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='stalking'/><category scheme='http://www.blogger.com/atom/ns#' term='sliding'/><category scheme='http://www.blogger.com/atom/ns#' term='sonar'/><category scheme='http://www.blogger.com/atom/ns#' term='mapping'/><category scheme='http://www.blogger.com/atom/ns#' term='arnold'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>NXT, "the thing's" of Arnold</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Jq__kevBr8s/R6xdtdl9P3I/AAAAAAAAAsM/0AyoNyPe_bY/s1600-h/arnold3.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://1.bp.blogspot.com/_Jq__kevBr8s/R6xdtdl9P3I/AAAAAAAAAsM/0AyoNyPe_bY/s320/arnold3.jpg" alt="" id="BLOGGER_PHOTO_ID_5164605908306444146" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The first example of an impossible design is "the thing" (1) of Arnold.&lt;br /&gt;It looks like a body, and arms attached to the knees...the head being the sonar.&lt;br /&gt;This design was able to make a scissor movement, the actual advantage of this was unknown.&lt;br /&gt;&lt;br /&gt;The goal was scanning the objects in the room and constructing a map by combining observations from different positions,&lt;br /&gt;using the sonar sensor, and three motors.&lt;br /&gt;&lt;br /&gt;This requires also a bit of programming, combining observation data and a bit of recognition. A compass sensor is very convenient and probably necessary for this.&lt;br /&gt;&lt;br /&gt;The plan is to do the programming in C or C++, with the addition of OpenGL to make the map. This kind of program should run on the computer, connected with bluetooth to the NXT.&lt;br /&gt;Another thought is to do it "all" on the NXT itself. A real challenge, which asks for a bit of thought about effective reducing and storing data. After making the map, the file can be send to a PC.&lt;br /&gt;&lt;br /&gt;To Arnolds total deception and desparation another model had to be made before his "thing" was finished. But he will come back to this idea, which will be very consolating.&lt;br /&gt;To save his ideas for the future we took a few pictures.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Jq__kevBr8s/R6xdl9l9P1I/AAAAAAAAAr8/Bp02dRy0Ia8/s1600-h/arnold1.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://3.bp.blogspot.com/_Jq__kevBr8s/R6xdl9l9P1I/AAAAAAAAAr8/Bp02dRy0Ia8/s320/arnold1.jpg" alt="" id="BLOGGER_PHOTO_ID_5164605779457425234" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Particularly nice was the cogwheel construction, for turning the sonar sensor. These cogwheels, especially rounded for this purpose, can be used standing in a right angle to each other. &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Jq__kevBr8s/R6xdp9l9P2I/AAAAAAAAAsE/jS62tpXWSfw/s1600-h/arnold2.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://3.bp.blogspot.com/_Jq__kevBr8s/R6xdp9l9P2I/AAAAAAAAAsE/jS62tpXWSfw/s320/arnold2.jpg" alt="" id="BLOGGER_PHOTO_ID_5164605848176901986" border="0" /&gt;&lt;/a&gt;They can be seen at 1400 houres above the centre of the picture.&lt;br /&gt;&lt;br /&gt;The next thing was built a few weeks later, totally different, but also with a special signature: redundancy of parts and hybris in design - idea.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Jq__kevBr8s/R8pJLib1ImI/AAAAAAAAAvM/NyWXU812r1M/s1600-h/thing2.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://4.bp.blogspot.com/_Jq__kevBr8s/R8pJLib1ImI/AAAAAAAAAvM/NyWXU812r1M/s320/thing2.jpg" alt="" id="BLOGGER_PHOTO_ID_5173027584559358562" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;In his second Thing Arnold tried to use all the pieces in the Lego Box.  The white connection pieces, but also the handy black double pins were all exhausted. The upper build of sensors had to be done using axes.&lt;br /&gt;The design has only two wheels. A third turning wheel would become instable because of the weight. The structure is supposed to steer, sliding on the part without the wheels.&lt;br /&gt;The third motor can steer the upper sensor strutcture around.&lt;br /&gt;The goal was the same as the first thing: building to a considerable height for putting the sonar sensor on top. Then program to make a map of the room. In short: a radar.&lt;br /&gt;Cogwheels are another speciality as can be seen in a few pictures.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Jq__kevBr8s/R8pJRSb1InI/AAAAAAAAAvU/Y93QASvvukU/s1600-h/cog1.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://3.bp.blogspot.com/_Jq__kevBr8s/R8pJRSb1InI/AAAAAAAAAvU/Y93QASvvukU/s320/cog1.jpg" alt="" id="BLOGGER_PHOTO_ID_5173027683343606386" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The upper structure has three custom sensors the only problem will be that these sensors have to be connected to the brick. This will prevent considerably the ability to turn the sensors around. The idea of putting the sound sensor in is to be able to follow a talking target.&lt;br /&gt;The light sensor, of course, will be able to follow the light. In this setting the sonar will also serve to avoid becoming a nuisance to the target! So the second "Thing" of Arnold has great stalking capabilities, only the surface must be very smooth!&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Jq__kevBr8s/R8pJFCb1IlI/AAAAAAAAAvE/3wz_CNBg_ho/s1600-h/thing2a.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_Jq__kevBr8s/R8pJFCb1IlI/AAAAAAAAAvE/3wz_CNBg_ho/s320/thing2a.jpg" alt="" id="BLOGGER_PHOTO_ID_5173027472890208850" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-3345375279842671621?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/3345375279842671621/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=3345375279842671621' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/3345375279842671621'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/3345375279842671621'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/02/nxt-thing-of-arnold.html' title='NXT, &quot;the thing&apos;s&quot; of Arnold'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Jq__kevBr8s/R6xdtdl9P3I/AAAAAAAAAsM/0AyoNyPe_bY/s72-c/arnold3.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-2611154812403282812</id><published>2008-02-04T09:02:00.000-08:00</published><updated>2008-02-04T09:40:10.591-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lejos'/><category scheme='http://www.blogger.com/atom/ns#' term='ArrayList'/><category scheme='http://www.blogger.com/atom/ns#' term='Arra'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>nxt, lejos, array and arrayList</title><content type='html'>Due to some inexperience in JAVA, a bit of trouble was caused by the special reduced JAVA class of ArrayList. The simplest things in other languages cost most of the time, so here a simple example is given with code that works on the brick.&lt;br /&gt;&lt;br /&gt;Arrays and ArrayLists can be of good use when you want to find a good configuration and you let the brick get the best answer, by simply trying out all the possible combinations stored in the Array!&lt;br /&gt;&lt;br /&gt;The code of this ArrayList class can be found here:&lt;br /&gt;&lt;a href="http://www.koders.com/java/fid9EB794717148396BA1384B9B134F7C37FB77C880.aspx#L131"&gt;http://www.koders.com/java/fid9EB794717148396BA1384B9B134F7C37FB77C880.aspx#L131&lt;/a&gt;&lt;br /&gt;this helps understanding the things that doesn't seem to work.&lt;br /&gt;&lt;br /&gt;for instance:&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Object myArray = someArraList.toArray() ;&lt;/span&gt;// does not work...because it isn't in this special class (Eclipse gives it as a choice though! To let the prog crash in the brick...)&lt;br /&gt;also&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;someArrayList.add(0, 7); &lt;/span&gt;//does not work, it does not even compile (the int is not recognized as object, ( but this could be official JAVA, although the comment is that the lejos Int class lacks some method...)&lt;br /&gt;&lt;br /&gt;so what to do about that? This: make an integer object yourself!&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Integer myInt = new Integer(55);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;someArrayList.add(0, myInt ) ;&lt;/span&gt; //this works and compiles&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;someArrayList.add(0, "aString" );&lt;/span&gt; //is accepted to, strange the int and the string are not treated the same simple way....&lt;br /&gt;&lt;br /&gt;Now say you have your own object: (constructor in the example, nothing exceptional, haha)&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;integerObject someInt = new integerObject(55); &lt;/span&gt;//whatever this is....&lt;br /&gt;then&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;someArrayList.add(0, someInt ); &lt;/span&gt;//works fine&lt;br /&gt;&lt;br /&gt;ok so lets make it into an complete though not too functional example prog  for the NXT:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;import java.util.*;&lt;/span&gt;&lt;br /&gt;import lejos.nxt.*;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;public class arraytest {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    static  ArrayList &lt;/span&gt;&lt;string&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; myMotorSpeedPlus = new  ArrayList &lt;/span&gt;&lt;string&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;(20);//accepted in brick&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    public static void main(String[] args) throws Exception {&lt;/span&gt;&lt;br /&gt;   &lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    integerObject someInt = new integerObject(55); //my own integer object see class below&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    integerObject otherInt = new integerObject(); //another one&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    integerObject[] rij = new integerObject[5]; //making this into an Array&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    rij[0] = someInt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    otherInt = rij[0]; //this works and compiles&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    int helloInt = (int) otherInt.ReadmyInteger (); //doing some things&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    LCD.drawInt( helloInt , 0 , 7 );&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    LCD.drawInt( (int) rij[0].ReadmyInteger () , 5 , 7 );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    int myTest[] = new int [5];&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    myTest[0]=5;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    myTest[1]=4;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    myTest[2]=3;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    myTest[3]=2;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    myTest[4]=1;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    ArrayList someArrayList= new ArrayList ();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    //someArrayList.add( 3, "hello"  );//this compiles&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    int mySize = someArrayList.size();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    //+++++++++ adding strings&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    //someArrayList.add(0, "hello"  );//this compiles and works&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    //++++++++++ my own objects&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    //someArrayList.add(0,  new integerObject(55)  ) ; //this works and compiles&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    //otherInt = (integerObject) someArrayList.get(0); //this compiles and works&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    Integer myInt = new Integer(55);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    someArrayList.add(0, myInt ) ; //this works and compiles&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    myInt = (Integer) someArrayList.get(0);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    mySize = someArrayList.size();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    someArrayList.add(0, myInt  );&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    someArrayList.add(0, myInt  );&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    someArrayList.add(0, otherInt  );&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    LCD.drawInt( myMotorAL.size() , 8 , 7 ); //and this gives the size&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;     while(!Button.ESCAPE.isPressed() ) {  //ok this keeps going on till the button is pressed&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    for(int teller=0;teller&lt;&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;        LCD.drawInt( myTest[teller] , 0 , teller ); //it displays the content of the int array&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    LCD.refresh();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;     }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;//here the simple class integerObject&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;public class integerObject {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    private int myInt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    public integerObject (int comingIn ){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;        myInt = comingIn;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    public integerObject ( ){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;        myInt = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    public int ReadmyInteger ( ){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;        return myInt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;o&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;k , only to show the use of the Arrays of int and string and the ArrayList.&lt;/span&gt;&lt;/span&gt;&lt;/string&gt;&lt;/string&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-2611154812403282812?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/2611154812403282812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=2611154812403282812' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2611154812403282812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2611154812403282812'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/02/nxt-lejos-array-and-arraylist.html' title='nxt, lejos, array and arrayList'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-7347669740724543549</id><published>2008-01-26T12:46:00.000-08:00</published><updated>2008-01-29T22:22:20.107-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='webfun'/><category scheme='http://www.blogger.com/atom/ns#' term='links'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>nxt webfun</title><content type='html'>&lt;ul&gt;&lt;li&gt;--------------------------------------------------------------&lt;/li&gt;&lt;li&gt;See blog "hoofdmenu" for a list of subjects around the NXT&lt;br /&gt;&lt;/li&gt;&lt;li&gt;--------------------------------------------------------------&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Just a few links, using the searchengine on Mindstorms and NXT will reveal much more!&lt;br /&gt;Have fun!&lt;br /&gt;&lt;br /&gt; * &lt;a href="http://www.marioferrari.org/lego_mindstorm.html"&gt;http://www.marioferrari.org/lego_mindstorm.html&lt;/a&gt;&lt;br /&gt; * &lt;a href="http://www.extremenxt.com/lego.htm"&gt;http://www.extremenxt.com/lego.htm&lt;/a&gt;&lt;br /&gt; * &lt;a href="http://www.youtube.com/"&gt;http://www.youtube.com&lt;/a&gt;&lt;br /&gt; *&lt;a href="http://www.tau.ac.il/%7Estoledo/lego/"&gt; http://www.tau.ac.il/~stoledo/lego/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-7347669740724543549?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/7347669740724543549/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=7347669740724543549' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7347669740724543549'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7347669740724543549'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-webfun.html' title='nxt webfun'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-3713095211996283731</id><published>2008-01-26T12:45:00.001-08:00</published><updated>2008-03-02T10:02:50.609-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='lejos'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><category scheme='http://www.blogger.com/atom/ns#' term='environmetal variables'/><title type='text'>nxt, lejos and environmental variables</title><content type='html'>&lt;ul&gt;&lt;li&gt;--------------------------------------------------------------&lt;/li&gt;&lt;li&gt;See blog "hoofdmenu" for a list of subjects around the NXT&lt;br /&gt;&lt;/li&gt;&lt;li&gt;--------------------------------------------------------------&lt;/li&gt;&lt;/ul&gt; &lt;span style="font-weight: bold;"&gt;What&lt;/span&gt; are environmental variables:&lt;br /&gt;These are path, for Windows needed to findJAVA or Lejos.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Where&lt;/span&gt; to find:&lt;br /&gt;My Computer, right mouseclick in folder, system properties, TAB advanced, and environmental variables&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Needed&lt;/span&gt; for JAVA and lejos (the JAVA for the NXT):&lt;br /&gt;Example:&lt;br /&gt;PATH c:\java\jdk1.6.0_02\bin;c:\JAVA\lejos_nxj\bin&lt;br /&gt;not necessary: CLASSPATH&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Check&lt;/span&gt; it with the Command window&lt;br /&gt;Eclipse finds the paths itself, the paths are included in the .bat files of the lejos-JAVA environment&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-3713095211996283731?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/3713095211996283731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=3713095211996283731' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/3713095211996283731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/3713095211996283731'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-lejos-en-environmetal-variables.html' title='nxt, lejos and environmental variables'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-2957704081427740284</id><published>2008-01-26T12:43:00.000-08:00</published><updated>2008-12-10T02:07:54.158-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lejos'/><category scheme='http://www.blogger.com/atom/ns#' term='commandwindow'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>commandwindow for lejos</title><content type='html'>&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold;"&gt;The Commandwindow &lt;/span&gt;&lt;span&gt;is not need&lt;/span&gt;ed for firmware, nor for C or C#.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Needed &lt;/span&gt;for installing and flashing JAVA Lejos, and sometimes conveniant for other languages (Ruby)&lt;/p&gt;&lt;p&gt;(Icommand also, belonging to JAVA asks for a renewed struggle wit PATH, CLASSPATH, .jar's and other strange monsters. Problem: every laptop has to be configured again. If it works you tend to forget how it was done, because it is not something you reinstall everyday.)&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Jq__kevBr8s/R9Ykb95H-PI/AAAAAAAAAvs/jPyCarAGo6A/s1600-h/cmd.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://3.bp.blogspot.com/_Jq__kevBr8s/R9Ykb95H-PI/AAAAAAAAAvs/jPyCarAGo6A/s320/cmd.jpg" alt="" id="BLOGGER_PHOTO_ID_5176364884598192370" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Features &lt;/span&gt;of the command window&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;in the command window, capital letters and lower case can be used&lt;/li&gt;&lt;li&gt;if environmental variables are changed: close command window, to reopen it with the new settings&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;GENERAL COMMANDS &lt;/span&gt;in the COMMANDWINDOW&lt;br /&gt;&lt;br /&gt;The commandwindow is a bit primitive, no direct copy paste, luckily if a command does not work with the arrows (UP) you can get the command back and correct is, in all other cases: retype!&lt;br /&gt;&lt;ul&gt;&lt;li&gt;cd\      to go to the root&lt;/li&gt;&lt;li&gt;to get into a folder cd (foldername), but also cd (foldername partial)* the wild card star&lt;br /&gt;&lt;/li&gt;&lt;li&gt;cd..           with two points, to get back into a directory path one level&lt;br /&gt;&lt;/li&gt;&lt;li&gt;dir       to look at programs in the directory&lt;br /&gt;&lt;/li&gt;&lt;li&gt;path    to see the configuration of the path, for instance for JAVA: c:\java\jdk1.6.0_02\bin;c:\JAVA\lejos_nxj\bin&lt;/li&gt;&lt;li&gt;echo    %path%                    the same as path&lt;br /&gt;&lt;/li&gt;&lt;li&gt;echo   %classpath%             gives CLASSPATH aan&lt;/li&gt;&lt;li&gt;java    (check for  JAVA)    gives a list of JAVA, otherwise configure PATH :c:\java\jdk1.6.0_02\bin&lt;/li&gt;&lt;li&gt;copy and paste??? Hmmm: CTRL V doesn't work, but Yes: copy a command from somewhere and use in COMMANDWINDOW:  right mouse-click and choose copy&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="font-weight: bold;"&gt;Lejos Commands&lt;/p&gt;&lt;p&gt;When compiling with Eclipse (and not with the command window) the .bat file of Lejos finds it's way to the libraries&lt;/p&gt;&lt;ul&gt;&lt;li&gt;lejosdl  (check on installation of lejos) gives a list of commands, otherwise reconfigure PATH: c:\JAVA\lejos_nxj\lejosfirmdl                               to flash the firmware of lejos to the NXT (using USB)&lt;/li&gt;&lt;li&gt;lejosc programName.java     to compile a JAVA program, using the command window&lt;/li&gt;&lt;li&gt;lejos   programName             to send the compiled programm to the lejos (no .class)&lt;/li&gt;&lt;/ul&gt;For Icommand: (i am saving these experiments, for the next installations....)&lt;br /&gt;&lt;ul&gt;&lt;li&gt;set classpath , to check the classpath in the commandwindow&lt;br /&gt;&lt;/li&gt;&lt;li&gt;java -jar icommand.jar    checking the placements of the icommand.jar (although this is costing houres again, still not working, do I love the JAVA commandwindow combination?)&lt;/li&gt;&lt;ul&gt;&lt;li&gt;error: Unable to access jarfile icommand.jar&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;java %classpath% -jar icommand.jar&lt;/li&gt;&lt;ul&gt;&lt;li&gt;error: Exception in thread "main" java.lang.NoClassDefFoundError: shwoing classpath&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;in the JAVA directory: (first cd\ then in root C: cd java,  java -jar icommand.jar&lt;/li&gt;&lt;ul&gt;&lt;li&gt;error: Exception in thread "main" java.lang.NoClassDefFoundError: icommand.Properties, it seems to look for the icommand.Properties file, but cannot find it...hmmmm&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;in Eclipse, he finally found the icommand.properties.&lt;/li&gt;&lt;ul&gt;&lt;li&gt;device address is found in the bluetooth application (Bluesoleil with me)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-2957704081427740284?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/2957704081427740284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=2957704081427740284' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2957704081427740284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2957704081427740284'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-commandwindow-met-lejos.html' title='commandwindow for lejos'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Jq__kevBr8s/R9Ykb95H-PI/AAAAAAAAAvs/jPyCarAGo6A/s72-c/cmd.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-3163700488077068423</id><published>2008-01-26T12:42:00.000-08:00</published><updated>2008-02-20T00:00:41.684-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='troubleshooting'/><category scheme='http://www.blogger.com/atom/ns#' term='bluetooth'/><category scheme='http://www.blogger.com/atom/ns#' term='comport'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>nxt troubleshooting</title><content type='html'>&lt;ul&gt;&lt;li&gt;--------------------------------------------------------------&lt;/li&gt;&lt;li&gt;See blog "hoofdmenu" for a list of subjects around the NXT&lt;br /&gt;&lt;/li&gt;&lt;li&gt;--------------------------------------------------------------&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;The actual robot "around" the NXT can be rebuilt and rethought every time. Then while building you have to have an idea about the programming, using which language, and bluetooth or not. So you have to shift around the language on the brick, Lego firmware or Lejos JAVA, or even others. Bluetooth can be hindered by another language, different from the Lego firmware.&lt;/p&gt;I want to record here some of the problems encountered:&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Reinstalling Lego Firmware&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;After using Lejos JAVA. Connected to USB, working from the Firmware CD program. Problem: NXY not found, after minutes of waiting.&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Cause: using an extra USB HUB i had connected about 6 things to the laptop. Connecting the USB from the brick directly to the laptop solved this problem.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Firmware has to be installing itself within 60 seconds.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;ECLIPS problems&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;JAVA installed watch it: no space in the name of the folder Program Files -&gt; ProgramFiles&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Lejos installed , check lejos with lejosdl in Commandwindow&lt;/li&gt;&lt;li&gt;Eclips installed , using the JRE 1.3, as advised, can only be done when installed seperately, and is not really necessary.&lt;/li&gt;&lt;li&gt;Eclips gives problem {project_loc} unknown; try configuring hardpath&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Eclips gives problem  java_type_name , this was caused by dragging a file into eclipse, but not adding it to the project......&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Eclipse ok, compile, ok, upload incredible fast (&lt;500&gt;&lt;/li&gt;&lt;li&gt;Eclipse ok, USB connected, compile &amp;amp; upload: warning: bluetooth not found: can be caused by compiling and uploading too fast after connecting USB. Wait 3 seconds after the positive Windows beep of USB connection.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Bluetooth&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;In the beginning all went wrong, but actually this is simple!&lt;br /&gt;&lt;/p&gt;&lt;p&gt;In general:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;installed Bluetooth does not work: use dongle....20 euro's.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;first the Bluetooth dongle, V2.0 PROMEDION is ok on a  Toshiba, Toshiba's own bluetooth does not function&lt;br /&gt;&lt;/li&gt;&lt;li&gt;install WIDCOMM, free download, or&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Bluecove , this comes in a try out version, but still functions on my laptop.  &lt;/li&gt;&lt;li&gt;start bluetooth search: NXT is shown (or you have to ask: get name devices)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;select NXT: pairing in principle once.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;ouble click or right click, connect to serial (for instance devB, or directly serial COM8)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;pairing connection&lt;br /&gt;&lt;/li&gt;&lt;li&gt;NXT asks a pin, and the Bluetooth too, dont imagine anything different from the preset 1234&lt;/li&gt;&lt;li&gt;after this: you can test the connection in the bluetooth prog, but&lt;/li&gt;&lt;li&gt;Eclipse and C# programs connect and disconnect themselves!!!&lt;/li&gt;&lt;li&gt;ok the COM port is installed on YOUR computer, it is not something of the NXT&lt;/li&gt;&lt;li&gt;COM port number bigger than 10: not working reconfigure COM Ports (see below)&lt;/li&gt;&lt;li&gt;COM port number gets higher and higher : see below&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Bluetooth -&gt; COMpoorten problems&lt;/strong&gt;&lt;/p&gt;Repeat: dont connect first to the NXT and then start a prog from the laptop to connect, this prog connects itself. (I made this mistake in the beginning costing me quite some time to reconfigure the COM ports.....)&lt;br /&gt;&lt;p&gt;Ok, when made this mistake of double connecting and messing up your Ports:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Where to find theCOM ports: &lt;/p&gt;&lt;ul&gt;&lt;li&gt;A: Mycomputer, properties, hardware, (peripheriques ), Ports (Com en LPT)&lt;/li&gt;&lt;li&gt;B: or commandwindow en regedit.exe,  HKEY_LOCAL_MACHINE, HARDWARE, DEVICEMAP, SERIALCOMM,&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;vanuit versie A:&lt;/p&gt;&lt;p&gt;right click on PORT, TAB parameters, advanced, bottom, numberCOMport, configure: the number must be below 10&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The COM port numbers get higher and higher, while not using the lower ones, they were not cleaned up. In this window you can "reclaim" numbers a few times, thus "emptying" the PORT numbers. Primitive, but it works.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Then desinstall the old portnumbers, start the bluetooth configuring again, and in the end, the COM PORT mess, caused by double connections to the NXT, will be cleaned up.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-3163700488077068423?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/3163700488077068423/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=3163700488077068423' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/3163700488077068423'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/3163700488077068423'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-troubleshooting.html' title='nxt troubleshooting'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-4892604723923993830</id><published>2008-01-26T12:41:00.000-08:00</published><updated>2008-01-26T12:42:32.689-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lejos'/><category scheme='http://www.blogger.com/atom/ns#' term='metingen'/><category scheme='http://www.blogger.com/atom/ns#' term='getallen'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>nxt en harde data met de lejos classes</title><content type='html'>&lt;p&gt;Hier is nog genoeg te doen!!!&lt;/p&gt;&lt;p&gt;De classes van de Lejos firmware zijn goed beschreven, maar wat zegt een getal, in de method, wat wordt dit als de NXT werkelijk rijdt?&lt;/p&gt;&lt;p&gt;Als je in de firmware wilt werken zal je een beetje moeten gaan meten, hier een paar voorbeelden.&lt;/p&gt;&lt;p&gt;(Natuurlijk geldt dit evenzeer als je alles met bluetooth vanaf de PC gaat besturen, dat wil zeggen: dan mag je opnieuw meten....&lt;img src="http://blackboard.hsleiden.nl/webapps/lobj-wiki-bb_bb60/editor/plugins/emotions/images/smiley-foot-in-mouth.gif" alt="Foot in mouth" title="Foot in mouth" border="0" /&gt;) &lt;/p&gt;&lt;p&gt;Meetresultaten Pilot class&lt;/p&gt;&lt;p&gt;Rechte lijn: &lt;/p&gt;&lt;ul&gt;&lt;li&gt;Pilot robot = new Pilot(2.1f,4.4f,Motor.B, Motor.C,false);&lt;/li&gt;&lt;li&gt;robot.setSpeed(250); &lt;/li&gt;&lt;/ul&gt;&lt;p&gt; // battery level around 8300&lt;/p&gt;&lt;ul&gt;&lt;li&gt;robot.travel(-2);//            5 cm&lt;/li&gt;&lt;li&gt;robot.travel(-4);//            10 cm &lt;/li&gt;&lt;li&gt;robot.travel(-6);//            15 cm &lt;/li&gt;&lt;li&gt;robot.travel(-8);//-            20 cm&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;//dit ziet er redelijk lineair uit&lt;/p&gt;&lt;p&gt;------------------------------------------------------------------------------------------- &lt;/p&gt;&lt;p&gt;Cirkel:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;robot.steer( 75,400,false)&lt;/li&gt;&lt;li&gt;een hele cirkel is 400 , de 75 is het turnRate&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;turnRate     straal, positief de ene kant op negatief de andere -100, 100&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;100              5.5 cm (kleinste cirkel in deze klasse, ene wiel staat stil, in de andere klasse kan je op een punt draaien)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;75               11.5 cm de ene kant op 14 de andere kant op (dit kan niet liggen aan de positie van de pen)&lt;/li&gt;&lt;li&gt;50                  19 cm      &lt;/li&gt;&lt;li&gt;25                48 cm&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Met het draaien is de spreiding in de resultaten vrij groot, ondergrond?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-4892604723923993830?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/4892604723923993830/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=4892604723923993830' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/4892604723923993830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/4892604723923993830'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-en-harde-data-met-de-lejos-classes.html' title='nxt en harde data met de lejos classes'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-7928423565371159766</id><published>2008-01-26T12:39:00.002-08:00</published><updated>2008-12-10T02:07:54.890-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lightsensor'/><category scheme='http://www.blogger.com/atom/ns#' term='tiltsensor'/><category scheme='http://www.blogger.com/atom/ns#' term='balance'/><category scheme='http://www.blogger.com/atom/ns#' term='acceleration'/><category scheme='http://www.blogger.com/atom/ns#' term='sensors'/><title type='text'>nxt coming in balance</title><content type='html'>These movies look really funny:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.youtube.com/watch?v=b3vDnwwBmgQ"&gt;http://www.youtube.com/watch?v=b3vDnwwBmgQ&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.youtube.com/watch?v=b3vDnwwBmgQ"&gt;http://www.youtube.com/watch?v=nJGy_oMSmWE (where is this last one gone?)&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;some movies are really fake like this:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://video.aol.com/video-detail/another-balancebot-lego-mindstorms-nxt/3625739070"&gt;http://video.aol.com/video-detail/another-balancebot-lego-mindstorms-nxt/3625739070&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;Let us try to reproduce these things and learn something about balance and the sensors.&lt;/p&gt;&lt;p&gt;First the model: the nxt brick is upright, that means that the centre of mass is rather high up.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;(Similar balance examples are this child  game with the stick balancing on your nose, or the bike with one wheel...)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Jq__kevBr8s/R7Vb-AB2ztI/AAAAAAAAAtU/UuhbARJfwdM/s1600-h/test.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_Jq__kevBr8s/R7Vb-AB2ztI/AAAAAAAAAtU/UuhbARJfwdM/s320/test.jpg" alt="" id="BLOGGER_PHOTO_ID_5167137268195315410" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;First observations:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;this must be done with a prog in the brick, bluetooth has a considerable lag&lt;br /&gt;&lt;/li&gt;&lt;li&gt;the movie seems to use the light sensor, this is rather dependent on the surface...&lt;br /&gt;&lt;/li&gt;&lt;li&gt;let us try lejos JAVA with the acceleration sensor i bought...&lt;/li&gt;&lt;/ul&gt;The movements should be short and not to far from equilibrium...&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;(In the picture two sensors can be seen: the lightsensor (used in the movies) and the tiltsensor. I was too naiv: sensors cost time, and the tiltsensor (I2C) above all....i continued with the wrong one: the tiltsensor....)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;sensors:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;most movies use the lightsensor: strange, because in this setting only about three values are available, say -1, 0, 1 around equilibrium.&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;(ok later on i found out that the JAVA "readvalue()" method gives only values between 0 and 100 (normalized) You have to use contrary to expectations: &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;readNormalizedValue() which gives values between 0 ans 1023)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;the acceleration (tilt) sensor, using the x-angle, this gives a range of about 30 steps , 15 each side of equilibrium&lt;/li&gt;&lt;/ul&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Jq__kevBr8s/R7VclgB2zuI/AAAAAAAAAtc/L7pvo_qV96k/s1600-h/accel.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://4.bp.blogspot.com/_Jq__kevBr8s/R7VclgB2zuI/AAAAAAAAAtc/L7pvo_qV96k/s320/accel.jpg" alt="" id="BLOGGER_PHOTO_ID_5167137946800148194" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Jq__kevBr8s/R7VcrwB2zvI/AAAAAAAAAtk/kVnmj25JCNA/s1600-h/light.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://1.bp.blogspot.com/_Jq__kevBr8s/R7VcrwB2zvI/AAAAAAAAAtk/kVnmj25JCNA/s320/light.jpg" alt="" id="BLOGGER_PHOTO_ID_5167138054174330610" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;motor methods:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;motor.A.forwards(speed) and backwards, steers 2 motors (A and B) at the same time&lt;br /&gt;&lt;/li&gt;&lt;li&gt;motor.A.rotateTo(angle, true), this steers one motor, and the other lags behind!&lt;/li&gt;&lt;/ul&gt;First try: find equilibrium and then just drive in the opposite direction when needed:&lt;p&gt;if (  (senosrValue - midPoint) &gt; 0 )&lt;br /&gt;{&lt;br /&gt;Motor.A.forward();&lt;br /&gt;Motor.B.forward();&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;Motor.A.backward();&lt;br /&gt;Motor.B.backward();&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;But this seems to brutal, there are four parameters involved:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;equilibrium&lt;/li&gt;&lt;li&gt;driving time&lt;/li&gt;&lt;li&gt;speed of driving&lt;br /&gt;&lt;/li&gt;&lt;li&gt;waiting time, between the driving (waiting time??? please dont waist any time!!!)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;The next thing to try is, make the speed a function of the measured angle&lt;br /&gt;............hmmm doesn't work to well&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Let's think: this is actually a reversed pendulum, and the acrobat on the one wheel bike is also in perpetual movement, she is not waiting to fall, and then reacting, could we try a balancing movement?&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Then we have to find the time this this is swinging on.....&lt;br /&gt;a long time ago Huygens mae his clocks and since then this is called the law of Huygens...&lt;br /&gt;&lt;/p&gt;&lt;dl&gt; &lt;img class="tex" src="http://upload.wikimedia.org/math/b/3/1/b3129742fed41e2f6d2e6962c78a3cdc.png" alt="T_0 = 2\pi\sqrt{\frac{\ell}{g}}" /&gt;&lt;br /&gt;this means a swing time of about ...... 6/10 or a thread of 600 milliseconds, way to long.....&lt;br /&gt;anyway also this experiment fails&lt;br /&gt;the centre of mass could be moved higher up.&lt;br /&gt;of course much depends on the model...&lt;p&gt;Nelleke proposed to make the robot self learning, but actually this is a 4 parameter space,&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;equilibrium&lt;/li&gt;&lt;li&gt;driving time&lt;/li&gt;&lt;li&gt;waiting time&lt;/li&gt;&lt;li&gt;force of driving&lt;/li&gt;&lt;/ul&gt;&lt;/dl&gt;this as a minimum...&lt;br /&gt;&lt;dl&gt;could he find his way in this space at random? (No of course not, this is 4 dimensional, easy to loose your way! Later on i reduced this space to : one! speed!)&lt;br /&gt;&lt;br /&gt;what is the criterium to decide a good match?&lt;br /&gt;&lt;br /&gt;I have tried to reduce the parameter space, and after that i could use an array for each amplitude around equilibrium and get the outcome decide to change this value, this didn't improve things much.&lt;br /&gt;&lt;br /&gt;I tried to reduce the driving/waiting time altogehter, and only change backwards forwards when neccessary, so in case of going over to the other side of equilibrium. Using a few switches.&lt;br /&gt;This seemed to improve things but not too enough.&lt;br /&gt;&lt;br /&gt;Driving speeds: depends on battery level, but normally below 300 (Lejos value) is was too slow, i used values aroud 500.&lt;br /&gt;&lt;br /&gt;Problems:&lt;br /&gt;&lt;/dl&gt;&lt;ul&gt;&lt;li&gt;the corrections are too brutal, it is impossible to stay close enough to equilibrium. When the angle of falling is too large, the NXT is too late to get itself upright. It should become more subtile and gracious in its movements!&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;dl&gt;For the moment this experiment failed!&lt;br /&gt;&lt;br /&gt;Could we use the acceleration and not the angle, in the acceleration sensor?&lt;br /&gt;&lt;br /&gt;//-----------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;This failure prompted a more detailed study of the sensors.&lt;br /&gt;The accel sensors, as all the I2C sensors are considerably slower then the light sensor.&lt;br /&gt;Also changing the speed in the motors has to be studied.&lt;br /&gt;(Any difference using bluetooth - yes: back to lejos JAVA in the brick.)&lt;br /&gt;Then an estimate can be made of the response time of the total system&lt;br /&gt;them we can see if this response time is fast enough to do the balancing trick,- or not! In the brick the lightsensor is speedy, the limiting factor is now the reaction time of the motors.&lt;br /&gt;&lt;br /&gt;//-----------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Research on the sensors showed that the lightsensor is the fastest, and has to be used instead of the tiltsensor, which is I2C.&lt;br /&gt;But also using the lightsensor in the readNormalizedValue() mode, it gives more accurate measurements then the readValue(). The only problem is these measurements are not symmetric: closer to the table and further from the table, the light is not linearly increasing/decreasing.&lt;br /&gt;But only using a small middle range of floating motors and the quickest possible reaction of the motors at fixed speed of 600 gave a far better result then anything before.&lt;br /&gt;It starts balancing!&lt;br /&gt;&lt;br /&gt;//---------------------------------------------------------------------------------&lt;br /&gt;Tried using bigger wheels, and went back to the smaller ones.&lt;br /&gt;Introduced the angle for the motors, Motor.B.rotate(angleT, true).&lt;br /&gt;Speed fixed, but is very important: 600 in Lejos JAVA.&lt;br /&gt;Time consuming is configuring the average for the lightsensor. Each surface is different in reflection. Eventually I calibrated before letting it balance like this:&lt;br /&gt;&lt;br /&gt;Sound.beep();&lt;br /&gt;for(int x=0;x&lt;10000;x++)     equilib = (int)((equilib + tilt.readNormalizedValue())/2);  Sound.beep();  &lt;br /&gt;//the beeps to indicate starting and ending calibration, the lightsensor is very fast!&lt;br /&gt;&lt;br /&gt;then here what i used in the loop:&lt;br /&gt;&lt;br /&gt;if ( Math.abs( myAverage) &gt;5  ){&lt;br /&gt;                    angleT =  15 + 15 * Math.abs(myAverage ); //angle varying for being out of balance&lt;br /&gt;                    if ( myAverage &lt; 5   )       &lt;br /&gt;                           {     Motor.B.rotate(angleT, true);     Motor.A.rotate(angleT, true);     }    &lt;br /&gt;                    else      &lt;br /&gt;                            {     Motor.B.rotate(-angleT, true);     Motor.A.rotate(-angleT, true);     }    &lt;br /&gt;}    else&lt;br /&gt; {     Motor.A.stop();     Motor.B.stop();     } &lt;br /&gt;&lt;br /&gt;with a speed of 600 it started balancing for a second or so, and had still to be helped&lt;br /&gt;example movie (really no fake!) But I could leave the supporting strips out now!&lt;br /&gt;&lt;br /&gt;work in progress!              &lt;/dl&gt;&lt;object width="320" height="266" class="BLOG_video_class" id="BLOG_video-dcaaf8f6699debf4" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;&lt;param name="movie" value="http://www.youtube.com/get_player"&gt;&lt;param name="bgcolor" value="#FFFFFF"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="flashvars" value="flvurl=http://v5.nonxt6.googlevideo.com/videoplayback?id%3Ddcaaf8f6699debf4%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1329954397%26sparams%3Did,itag,ip,ipbits,expire%26signature%3DF66C12C0BCA48F129875E7F51719BC1E38C6E38.1C7B2F8B480D649EB57AC4D992572EA3D7F771AA%26key%3Dck1&amp;amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3Ddcaaf8f6699debf4%26offsetms%3D5000%26itag%3Dw160%26sigh%3DqJWwAA-olR9mmoRUhMpPdgDjSPA&amp;amp;autoplay=0&amp;amp;ps=blogger"&gt;&lt;embed src="http://www.youtube.com/get_player" type="application/x-shockwave-flash"width="320" height="266" bgcolor="#FFFFFF"flashvars="flvurl=http://v5.nonxt6.googlevideo.com/videoplayback?id%3Ddcaaf8f6699debf4%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1329954397%26sparams%3Did,itag,ip,ipbits,expire%26signature%3DF66C12C0BCA48F129875E7F51719BC1E38C6E38.1C7B2F8B480D649EB57AC4D992572EA3D7F771AA%26key%3Dck1&amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3Ddcaaf8f6699debf4%26offsetms%3D5000%26itag%3Dw160%26sigh%3DqJWwAA-olR9mmoRUhMpPdgDjSPA&amp;autoplay=0&amp;ps=blogger"allowFullScreen="true" /&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-7928423565371159766?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='enclosure' type='video/mp4' href='http://www.blogger.com/video-play.mp4?contentId=dcaaf8f6699debf4&amp;type=video%2Fmp4' length='0'/><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/7928423565371159766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=7928423565371159766' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7928423565371159766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7928423565371159766'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-nog-niet-in-evenwicht.html' title='nxt coming in balance'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Jq__kevBr8s/R7Vb-AB2ztI/AAAAAAAAAtU/UuhbARJfwdM/s72-c/test.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-60554494554777711</id><published>2008-01-26T12:39:00.001-08:00</published><updated>2008-01-27T06:33:01.172-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bike'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>nxt bike</title><content type='html'>&lt;p&gt;Het idee is om een voertuig te testen dat in evenwicht moet blijven. Een Nederlandse fiets heeft deze eigenschap. Met name de voorvorkconstructie helpt hierbij enorm. Zouden we dat idee kunnen vertalen naar een 'fietsende robot'?&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Hier de schets:&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.contrechoc.com/nxt/bike.jpg" alt="" /&gt; &lt;/p&gt;&lt;p&gt;We gaan het ding bouwen!&lt;/p&gt;&lt;p&gt;Aanschouw de schoonheid! &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;img src="http://www.contrechoc.com/nxt/bike1.jpg" alt="" /&gt; &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Een geweldig, slim gemaakt, voorwiel.&lt;/p&gt;&lt;p&gt; &lt;img src="http://www.contrechoc.com/nxt/bike2.jpg" alt="" /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;En een gammel achterwiel. &lt;/p&gt;&lt;p&gt;&lt;img src="http://www.contrechoc.com/nxt/bike3.jpg" alt="" /&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-60554494554777711?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/60554494554777711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=60554494554777711' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/60554494554777711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/60554494554777711'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-bike.html' title='nxt bike'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-4433472098386848317</id><published>2008-01-26T12:37:00.002-08:00</published><updated>2008-02-01T23:16:20.460-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scorpion'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><category scheme='http://www.blogger.com/atom/ns#' term='base model'/><title type='text'>nxt base model scorpion (arnold and bram)</title><content type='html'>&lt;h1&gt;Scorpion? Six legged thing?&lt;/h1&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;The lego thing is great, that you can make all kinds of models from the same set of components in no time.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The disadvantage is only that each time you have to deconstruct the last model. The smart solution used in the last models are quickly forgotten.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Making a few pictures helps, but documenting the whole process of assemblege is quite a job, as can be seen when you follow the instructions to build the standard models on the website of the NXT.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;img src="http://www.contrechoc.com/nxt/insect1.jpg" border="0" width="400" /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;pictures of Jos....&lt;/p&gt;&lt;p&gt;This animal model, a sort of insect or scorpion, seems to have six legs....and all these legs are driven by two motors. So how is this done? Well it is a combination of smart transfer of motors with the help of a few cogwheels, and pure suggestion!&lt;/p&gt;&lt;p&gt;The stinger is a very fascinating object, generating a sudden and large movement with all its hinges.&lt;/p&gt;&lt;p&gt;The program going with the scorpion in firmware worked well, detecting an objet and stinging, please put yous hand under the sting, because otherwise the touch sensor might be hurt :-)&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.contrechoc.com/nxt/insect2.jpg" border="0" width="400" /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-4433472098386848317?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/4433472098386848317/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=4433472098386848317' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/4433472098386848317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/4433472098386848317'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-basismodel.html' title='nxt base model scorpion (arnold and bram)'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-1956306094970991162</id><published>2008-01-26T12:37:00.001-08:00</published><updated>2008-01-26T12:37:27.222-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='letters'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>nxt en letters</title><content type='html'>&lt;p&gt;&lt;u&gt;&lt;strong&gt;&lt;span style="font-size:100%;"&gt;Letters tekenen&lt;/span&gt;&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;&lt;p&gt;Hiervoor gebruik ik niet de methode van de vormen met het vector algorithme, want dan worden de letters zo hoekig.&lt;/p&gt;&lt;p&gt;Ik heb gewoon alle letters gemaakt met cirkels en lijnen, was een heel gedoe, vooral de s....&lt;/p&gt;&lt;p&gt;De NXT kan je naam schrijven! &lt;/p&gt;&lt;p&gt;Hier komt een foto....:-)&lt;/p&gt;&lt;p&gt;Hier komt het progje....:-)&lt;/p&gt;&lt;p&gt;Er kan nog veel gesleuteld worden aan dit idee....bv zou het leuk zijn een ellips te kunnen tekenen voor de ronde letters als de o, de a, de p enzovoort...&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-1956306094970991162?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/1956306094970991162/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=1956306094970991162' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/1956306094970991162'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/1956306094970991162'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-en-letters.html' title='nxt en letters'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-89570873650625951</id><published>2008-01-26T12:36:00.001-08:00</published><updated>2008-03-02T10:02:26.916-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scaling'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='vector'/><category scheme='http://www.blogger.com/atom/ns#' term='drawing'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>nxt, drawing shapes</title><content type='html'>&lt;p&gt;&lt;u&gt;&lt;strong&gt;&lt;span style="font-size:100%;"&gt;Drawing shapes&lt;/span&gt;&lt;/strong&gt;&lt;/u&gt; (lejos JAVA)&lt;/p&gt;For this you need a model which can be steered and has a possibility of making a line on a piece of paper.&lt;br /&gt;&lt;p&gt;You could make a shape by carefully putting together the steering commands, but then you can only make one shape and rescaling is not possible anymore.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;This is a way of programming a shape coming from a list of points. You have to calculate angles and length, depending on the scale you choose.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;(This is one of the ways) &lt;/p&gt;&lt;p&gt;public static void myAngle ( Point p1, Point p2, Point p3  ) //always three points, from where, where am I, where am i going to?&lt;br /&gt;    {&lt;br /&gt;        double scale = 2.0; //putting in the scaling factor&lt;br /&gt;      &lt;br /&gt;        double p1x = scale * (double) p1.getX(); //using a simple Point class to get components X, Y&lt;br /&gt;        double p1y = scale * (double) p1.getY();&lt;br /&gt;      &lt;br /&gt;        double p2x = scale * (double) p2.getX();&lt;br /&gt;        double p2y = scale * (double) p2.getY();&lt;br /&gt;      &lt;br /&gt;        double p3x = scale * (double) p3.getX();&lt;br /&gt;        double p3y = scale * (double) p3.getY();&lt;br /&gt;&lt;br /&gt;           double v1x = p2x - p1x; //making a vector of the points&lt;br /&gt;&lt;/p&gt;&lt;p&gt;            double v1y = p2y - p1y;&lt;br /&gt;         &lt;br /&gt;           double v2x = p3x - p2x;&lt;br /&gt;           double v2y = p3y - p2y;&lt;br /&gt;         &lt;br /&gt;           //length of vector 1&lt;br /&gt;           double l = Math.sqrt( v1x * v1x + v1y* v1y ); //the formula of Pythagore, for length&lt;br /&gt;         &lt;br /&gt;           //length of vector 2&lt;br /&gt;           double lv = Math.sqrt( v2x * v2x + v2y* v2y );&lt;br /&gt;         &lt;br /&gt;           //projection on vector 1 of vector 2&lt;br /&gt;           double ill = v1x/l*v2x + v1y/l*v2y ; //using an inner product&lt;br /&gt;         &lt;br /&gt;           //other part of vector&lt;br /&gt;           double ikk = Math.sqrt( lv * lv - ill * ill  );&lt;br /&gt;         &lt;br /&gt;           //get angle&lt;br /&gt;           double pi = 3.141592654;&lt;br /&gt;         &lt;br /&gt;           if(Math.abs(ikk) &lt; .001){  ikk = .001;   } //dont divide by zero!!!&lt;br /&gt;&lt;/p&gt;&lt;p&gt;          &lt;br /&gt;           double atan = 100 - Math.atan( ill/ikk ) / pi * 200; //use the arctan to get the angle back, but wait!&lt;br /&gt;         &lt;br /&gt;           //get further info on direction&lt;br /&gt;           double dir = v1y * v2x - v1x * v2y;//left or right of the line from p1 to p2?&lt;br /&gt;           if (dir&lt;0) atan =" -atan;"&gt;&lt;p&gt;             robot.travel( (float) (lv*3) );&lt;/p&gt;&lt;p&gt;     }&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;Then the only thing you need to draw your logo is a list of those points.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Here should be added a nice photo and the example prog to make life easier!!&lt;/p&gt;&lt;p&gt;:-)&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-89570873650625951?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/89570873650625951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=89570873650625951' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/89570873650625951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/89570873650625951'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-vormen-tekenen.html' title='nxt, drawing shapes'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-4621731285060106145</id><published>2008-01-26T12:33:00.000-08:00</published><updated>2008-03-02T09:53:31.123-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tekenen'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>nxt als turtlebot (dutch)</title><content type='html'>&lt;p&gt;&lt;strong&gt;&lt;span style="font-size:100%;"&gt;Mindstorms voorbeelden en experimenten&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;als eerste bouwden we de dertig minuten robot. Daarmee kan je de voorbeelden doornemen die allerlei mogelijkheden laten zien. Als eerste via het drag en drop menu van de lego mindstorms software.&lt;/p&gt;&lt;p&gt;programmeren is een kant, de andere kant is de bot zelf, het ding. Hoe 'het ding' is gebouwd blijkt nogal wat invloed te hebben op de uitvoering van het progje.  Voor deze wijshied moet vast wel ergens een interessant citaat te vinden zijn.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;turtlebot &lt;/strong&gt;&lt;/p&gt;&lt;p&gt;het tweede experiment is een tekenende robot, (twee motoren) &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;table style="border: medium none  ! important;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;Bij tekenen speelt de lijn een grote rol, het karakter van de lijn, lijnspanning etc, de verwachting is dat de verschillen tussen een objectieve plot zoals die uit een computer komt en de lijn van de bot die beinvloedt wordt door de buitenwereld, oppervlak, wielen instabiliteit een interessant exploratieterrein kunnen vormen, voor zowel de programmeur als de kunstenaar.) &lt;/p&gt;&lt;p&gt;paar voorbeelden van wat voor de mindstorms nog even niet te doen is....&lt;/p&gt;&lt;p&gt; &lt;img src="http://blackboard.hsleiden.nl/webapps/lobj-wiki-bb_bb60/wiki_home/Handler/1190381733625-1357793156--933059589/Home?cmd=GetImage&amp;amp;systemId=mi4__0.jpg" alt="" /&gt;&lt;/p&gt;&lt;p&gt;De Mindstorms heeft voorlopig nog voorkeur voor wat meer formele en abstracte kunst....&lt;img src="http://blackboard.hsleiden.nl/webapps/lobj-wiki-bb_bb60/editor/plugins/emotions/images/smiley-wink.gif" alt="Wink" title="Wink" border="0" /&gt;&lt;/p&gt;&lt;p&gt;Bij de turtlebot komen wat 'uitdagingen' aan het licht: de bouw van de robot heeft veel invloed op de uitvoering van zijn progje. Bv de tekenstift moet wel tussen de twee wielen instaan, anders krijg je al bij een simpel vierkant zwabbers in je getekende lijn. Nelleke merkt op dat je dit met behulp van programmatuur kan compenseren. bram denkt dat dit niet kan, zolang de pen niet van het papier te halen is, je dan hebt immers geen draaipunt om de penpunt heen.&lt;/p&gt;&lt;p&gt;&lt;img src="http://blackboard.hsleiden.nl/webapps/lobj-wiki-bb_bb60/wiki_home/Handler/1190381733625-1357793156--933059589/Home?cmd=GetImage&amp;amp;systemId=mi2__0.jpg" alt="" /&gt; &lt;/p&gt;&lt;ul&gt;&lt;li&gt;iemand een idee voor een ontwerp met een op en neergaande pen? Niels denkt aan veren, bram denkt aan een versie die zijn evenwichtspunt kan 'kiepen'.&lt;/li&gt;&lt;li&gt;er is een probleem met de 'brick' in dit ontwerp, die is vanwege de batterijen ook vrij zwaar en zou dus laag moeten liggen, boven de wielen, maar dan is er geen plaats meer voor de pen, moeten de batterijen apart worden geplaatst? Dan kan je namelijk ze verdelen aan twee kanten en de pen in het midden laten, ideeen?&lt;/li&gt;&lt;li&gt;een kiepmodel heeft het nadeel dat als het kiepen de pen van papier moet halen, dit alleen kan als de pen niet meer in het midden tussen de rijdende as kan staan &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Als de pen precies midden tussen de wielen staat is er geen afwijking meer, maar zie je dat desondanks vervomingen optreden, doordat de orientatie blijkbaar toch verstoord wordt, hoe zou dit te verhelpen zijn?. &lt;/p&gt;&lt;p&gt;vanuit het oogpunt van een kunstenaar behoren deze afwijkingen tot de 'signatuur' van de robot, en zijn daarom interessant. De resultaten worden daarom ook niet vergeten.&lt;/p&gt;&lt;p&gt;Vanwege de afwijkingen komt bram op het volgende idee: kan je de afstandsensor gebruiken om met de hand (die je in de buurt van de sensor beweegt) de robot te 'duwen' en kan je met deze handbewegingen dan de robot en daarmee de tekenlijn sturen? Dit wordt de volgende test.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-4621731285060106145?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/4621731285060106145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=4621731285060106145' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/4621731285060106145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/4621731285060106145'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-als-turtlebot.html' title='nxt als turtlebot (dutch)'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-716907054420558796</id><published>2008-01-26T12:31:00.000-08:00</published><updated>2008-02-26T01:10:15.343-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='bluetooth'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>NXT, steering with page on the web</title><content type='html'>Very remote steering this time!&lt;br /&gt;Idea: steering of the NXT with a page on the internet.&lt;br /&gt;&lt;br /&gt;PHP -&gt; Server -&gt; C# prog -&gt;bluetooth -&gt; NXT&lt;br /&gt;&lt;br /&gt;The C# prog can be found here, it is a changed version of the example of Bram Fokke.&lt;br /&gt;&lt;br /&gt;Je kan via de webpagina de NXT aansturen vanaf&lt;br /&gt;&lt;br /&gt;  * laptops,&lt;br /&gt;  * nDS met browser, inn de buurt van een hotspot&lt;br /&gt;  * Second Life (Lindenscript)&lt;br /&gt;  * en waarop je verder nog een browser aan de praat kunt krijgen, of een POST of GET connectie met een server kan maken.&lt;br /&gt;&lt;br /&gt;Voorwaarde: het C# prog moet aanstaan om de NXT te besturen met een bluetooth dongle&lt;br /&gt;&lt;br /&gt;Voordeel: geen last meer van VISTA MAC of PC specifieke dingen&lt;br /&gt;&lt;br /&gt;Nadeel, een 'zekere' traagheid (twee oorzaken, de serververbindingen en de bluetooth)&lt;br /&gt;&lt;br /&gt;Het prog is nog in ontwikkeling, je kan de COMpoort instellen voor het connecten, nu ook ingestelbaar is de motorpower, (alhoewel de C# er niet uitziet, met zijn windowsgrafgrijs, is het toevoegen van sliders en invoervelden wel erg comfortabel....)&lt;br /&gt;&lt;br /&gt;  * ok, weer wat uitgevonden in C#: de picturebox, voor plaatjes&lt;br /&gt;  *  deBackColor property van het hoofddesign, (weg grafgrijs...) wat kan er allemaal niet, in C#    :-), nou: een gele achtergrond.......?&lt;br /&gt;&lt;br /&gt;De PHP pagina, waarop je dus de NXT aanstuurt, is ook nog in ontwikkeling:  &lt;a href="http://www.contrechoc.com/sl/nxt/motorA.php"&gt;http://www.contrechoc.com/sl/nxt/motorA.php&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;(De PHP pagina wordt binnenkort vervangen door een FLASH animatie die de server 'in design' gaat bespelen.)&lt;br /&gt;&lt;br /&gt;Op Second Life kan je ook al terecht voor deze methode, er staan nu een aantal knoppen op het grondstuk &lt;a href="http://slurl.com/secondlife/Tintafel/13/229/87"&gt;'Silly Things'&lt;/a&gt;,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-716907054420558796?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/716907054420558796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=716907054420558796' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/716907054420558796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/716907054420558796'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-via-een-webpagina.html' title='NXT, steering with page on the web'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-4426074577308492594</id><published>2008-01-26T12:27:00.000-08:00</published><updated>2008-03-02T09:51:34.249-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bluetooth'/><category scheme='http://www.blogger.com/atom/ns#' term='wii'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>NXT and the WII remote control</title><content type='html'>Who doesn't want to programme the WII (remote control)?&lt;br /&gt;First get the bluetooth working!&lt;br /&gt;then read this article to get to know Glove Pie:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://crustea.vjfrance.com/article-130714-6.html"&gt;http://crustea.vjfrance.com/article-130714-6.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;BlueSoleil, is more easy to use then other bluetooth prog's, like Widcomm.&lt;br /&gt;&lt;br /&gt;if you are lucky the COMPORTS behave normally and bluetooth is no problem (otherwise try &lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-troubleshooting.html"&gt;troubleshooting&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;  * connection WII &lt;-&gt; bluetooth reaaly without a problem&lt;br /&gt;  * de C++ &lt;-&gt; bluetooth normally too, unless... ... --my mistake wat to think i had to start the bluetooth connection before i started the prog--&lt;br /&gt;        o watch it the cobbection can go two ways, from laptop to NXT or the other way around  for Wii you need PC to NXT&lt;br /&gt;        o ok the progs in C++ or C# make the connection themselves&lt;br /&gt;&lt;br /&gt;The article describes how to get the Wii remote control working actually for all programmes.&lt;br /&gt;&lt;br /&gt;  * in fact the steering is from the PC, only the PC prog is steered by the Wii.&lt;br /&gt;&lt;br /&gt;So you need a prog on your laptop with mouseEvents or Keyboardevents which sends signals through bluetooth to the  NXT .&lt;br /&gt;&lt;br /&gt;In the example of Anders, ( &lt;a href="http://www.norgesgade14.dk/bluetoothlibrary.php"&gt;http://www.norgesgade14.dk/bluetoothlibrary.php&lt;/a&gt; )  i  added openGL, then you can get a better interface then the simple console window, and you have an event loop at the same time. Wii input is directed by GlovePie to the C++ prog and hurray!!! The bot is being driven around by the Wii...!!!&lt;br /&gt;Can be done in any language of course, which has the bluetooth connection.&lt;br /&gt;Tip: in the C++ lib of Anders to get both motors driving at the same time: use the motorA.on() method in the C++ lib van Anders, and there will be synchronisation between the motors.&lt;br /&gt;&lt;br /&gt;(Doc:  LEGO Mindstorms Direct Commands, can be found in the LEGO MINDSTORMS NXT Bluetooth Developer)&lt;br /&gt;&lt;br /&gt;//------------------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Wii programming in general: (C++ lib, and other Wii features)&lt;br /&gt;&lt;br /&gt;  * &lt;a href="http://www.wiili.org/index.php/Wiiuse_C"&gt;http://www.wiili.org/index.php/Wiiuse_C&lt;/a&gt;&lt;br /&gt;  * &lt;a href="http://onakasuita.org/wii/index-e.html"&gt;http://onakasuita.org/wii/index-e.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;//------------------------------------------------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;Johnny Lee has some wonderful and simple ideas for the Wii, just type Wii and 3D in the searchengine and look for the Youtube video.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-4426074577308492594?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/4426074577308492594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=4426074577308492594' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/4426074577308492594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/4426074577308492594'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-en-de-wii-remote-control.html' title='NXT and the WII remote control'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-815961339540260679</id><published>2008-01-26T12:23:00.000-08:00</published><updated>2008-04-19T08:16:15.385-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='troubleshooting'/><category scheme='http://www.blogger.com/atom/ns#' term='bluetooth'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>nxt bluetooth</title><content type='html'>&lt;span style=";font-family:arial;font-size:85%;"  &gt;Bluetooth, the magical word!&lt;br /&gt;With Bluetooth you don't need the USB wire anymore, the NXT is freed!&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;Send a programm to the brick without cable connection.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;Or programming on your computer, using big memory and speed, sending the commands to the brick and receiving back the sensor values.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;be careful: setting registers in sensors is not possible, see &lt;a href="http://nxt-adventures.blogspot.com/2008/04/master-slave.html"&gt;master slave&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;You can steer the brick from your laptop!&lt;br /&gt;&lt;br /&gt;Preliminaries:&lt;br /&gt;&lt;/span&gt;&lt;ul  style="font-family:arial;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;the hardware: buy a dongle (sitecom...)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;install bluetooth software, Bluesoleil, or Widcomm&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;if all is in place  (The sitecom dongle seems to have bluetooth all in itself, later i connected without widcomm nor bluesoleil)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;do a "search" of bluetooth devices&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;find the brick and connect: pairing will be done (always use pin-key 1234 for both laptop and brick (in lejos only the PC askes for a code)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;a COMPORT number will be given&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;when this is done you can connect (by hand", using the COMPORT (in leftclick on brick icon in BlueSoleil)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;the COMPORT number is something on the laptop, not on the brick (another laptop another COMPORT number)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;the connection can go two ways: from laptop or from brick: you need from laptop&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;choose a programming environment, Dev Cpp, or C# (visual express)&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;if JAVA is wanted, use icommand, but somehow, this is difficult to get working in ECLIPSE&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;get some of the free libs, (I used Anders of Bram Fokke to start from, links see below)&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;the the examples coming with these libs connect and deconnect themselves&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;in case of programm stopping, look if Brick is deconnected to, sometimes need to restart brick and or dongle in and out of the laptop, to reset the bluetooth&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);font-family:arial;" &gt;another possibility is the "fantom API" provided by LEGO itself. I found this link: &lt;/span&gt;&lt;a style="font-weight: bold; font-family: arial; color: rgb(255, 0, 0);" href="http://epirsch.blogspot.com/2008/02/jna-love-nxt.html"&gt;http://epirsch.blogspot.com/2008/02/jna-love-nxt.html, &lt;/a&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);font-family:arial;" &gt;built the packages in ECLIPSE (added a bit of exception classes) and it worked! &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-family:arial;" &gt;For this only a dongle is needed, and the JAVA of course, including the jna.jar&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;In principle the bluetooth is very easy, but problems can be around every corner. My problems were: starting the bluetooth connection by hand before the prog on the laptop wanted to start too, getting a mess of COMPORTS numbers.&lt;br /&gt;&lt;br /&gt;The COMPORT number needs to be smaller then 10. If you encounter a number higher then 10, try&lt;a href="http://http//nxt-adventures.blogspot.com/2008/01/nxt-troubleshooting.html"&gt; troubleshooting&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Other tips:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;don't confuse icommands and bluetooth! Bluetooth is in the standard lib of Lejos and others, icommand only for JAVA-fans who want to steer the NXT from for instance ECLIPSE using bluetooth.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;as told: bluetooth is one, but steering the NXT is another: you need a prog on the laptop to send and receive the DIRECT COMMANDS send through Bluetooth. This can be found in the libs of Bram Fokke, using Microsoft Visual C# (good introduction!) or the libs of Anders in Dev Cpp.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;bluesoleil is ok for C++ and C#, for icommand/ECLIPSE bluesoleil seems to block the connection (see below)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;br /&gt;&lt;br /&gt;Free libs:&lt;br /&gt;&lt;/span&gt;&lt;ul  style="font-family:arial;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Anders C++: &lt;a href="http://www.norgesgade14.dk/bluetoothlibrary.php"&gt;http://www.norgesgade14.dk/bluetoothlibrary.php&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; Bram Fokke C#: &lt;a href="http://www.codeproject.com/useritems/nxtBluetooth.asp?df=100&amp;amp;forumid=420165&amp;amp;exp=0&amp;amp;select=2211060"&gt;http://www.codeproject.com/useritems/nxtBluetooth.asp?df=100&amp;amp;forumid=420165&amp;amp;exp=0&amp;amp;select=2211060&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;Documentation:&lt;br /&gt;&lt;/span&gt;&lt;ul  style="font-family:arial;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;de Bluetooth Developer Kit: &lt;a href="http://mindstorms.lego.com/Overview/NXTreme.aspx"&gt;http://mindstorms.lego.com/Overview/NXTreme.aspx&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;all the libs are based on &lt;a href="http://nxt-adventures.blogspot.com/2008/03/direct-commands-using-bluetooth-i2c.html"&gt;DIRECT COMMANDS&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;br /&gt;Ok using these libs, and building on the examples the NXT is driving around, steered from the PC.&lt;br /&gt;&lt;br /&gt;Further ideas: &lt;a href="http://http//nxt-adventures.blogspot.com/2008/01/nxt-via-een-webpagina.html"&gt;Steering from the web, or Second Life, using a server.&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Bluetooth problem: (loading progs to the brick)&lt;br /&gt;Later on with Bluesoleil installed i could not connect from the COMMANDWINDOW using lejos.&lt;br /&gt;Although the brick was running (lejos) the brick was not found from the COMMANDWINDOW, i could connect manually using Bluesoleil&lt;br /&gt;The solution was to desinstall Bluesoleil. This probably has to do with the dongel of sitecom i used.&lt;br /&gt;In the COMMANDWINDOW i used this to check:&lt;br /&gt;&lt;br /&gt;&lt;table style="width: 570px; height: 136px;" border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;C;\java\lejos_nxj\samples\tune&gt; lejosdl -b tune&lt;br /&gt;Linking...&lt;br /&gt;Uploading...&lt;br /&gt;Bluecove version 2.0.0 on winsock&lt;br /&gt;Found 5brickXT&lt;br /&gt;Upload succesful in 2344 milliseconds&lt;br /&gt;Bluecove stack shutdown completed&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Also using the ECLIPSE utility for the lejos i could now browse the brick using bluetooth and run programs&lt;br /&gt;From the console in ECLIPSE:&lt;br /&gt;&lt;br /&gt;&lt;table style="width: 492px; height: 136px;" border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Linking...&lt;br /&gt;Uploading...&lt;br /&gt;&lt;div style="text-align: left;"&gt;BlueCove version 2.0.0 on winsock&lt;br /&gt;&lt;/div&gt;Found: 5brickXT&lt;br /&gt;Upload successful in 5062 milliseconds&lt;br /&gt;BlueCove stack shutdown completed&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-815961339540260679?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/815961339540260679/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=815961339540260679' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/815961339540260679'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/815961339540260679'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-bluetooth.html' title='nxt bluetooth'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-3759708978637090972</id><published>2008-01-26T11:58:00.000-08:00</published><updated>2008-12-10T02:07:55.149-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='motor'/><category scheme='http://www.blogger.com/atom/ns#' term='PSP'/><category scheme='http://www.blogger.com/atom/ns#' term='acceleration'/><category scheme='http://www.blogger.com/atom/ns#' term='tilt'/><category scheme='http://www.blogger.com/atom/ns#' term='sensor'/><category scheme='http://www.blogger.com/atom/ns#' term='light'/><category scheme='http://www.blogger.com/atom/ns#' term='compass'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>NXT sensors</title><content type='html'>&lt;span style="font-size:85%;"&gt;In the NXT box there are 4 sensors:&lt;br /&gt;&lt;/span&gt;&lt;ul  style="font-family:arial;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;touch (on off switch)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;sound (sound level reading)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;sonar (distance reading between 7 cm and 255 cm),&lt;a href="http://nxt-adventures.blogspot.com/2008/03/nxt-mapping-radar.html"&gt; see mapping radar blog&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;light (difficult to give a scale here,&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;fast sensor&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;important is (in lejos) to use readNormalizedValue() method for values between 0 and 1023)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;on sensor port 4 the floodlight does not function (on my brick)&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;motor, the degrees of turning can be measured&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;used in the &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/03/nxt-mapping-radar.html"&gt;radar&lt;/a&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;, to compare with the compass, quite good cheap alternative!&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;someone found out that the motor ports differ in properties: &lt;a href="http://philohome.com/nxtpwr/pwr.htm"&gt;philohome&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;Other sensors can be bought, i bought them here: &lt;a href="http://www.mindsensors.com/"&gt;http://www.mindsensors.com/&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;These are I2C sensors, so they are much slower than the custom sensors. Also reading these sensors in one loop is a good test of the software you use: reading multiple I2C sensors poses a problem for the fantom lib and NEC. The C++ lib of Anders gives the right values, but is very slow: 3 sensor readings in 2 sec., for instance clock, compass, distance.&lt;a href="http://www.mindsensors.com/"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul  style="font-family:arial;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;compass (one readout raw: 0 - 512, in Anders Lib two precisions degree of half degree)&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;watch it: if the compass sensor too close to the brick it gives garbage! (10 cm is ok)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;I2C sensor: not fast&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;this sensor has to be as horizontal as possible otherwise the degrees measured will not cover the circle evenly, or even stay at one side of the center, this was discovered in &lt;a href="http://nxt-adventures.blogspot.com/2008/03/nxt-mapping-radar.html"&gt;the radar experiments&lt;/a&gt;.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;acceleration (6 readouts, tilt an accelaration, this can be used as a compass too?)&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;I2C sensor: not fast&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;camera (can follow objects,&lt;a href="http://nxt-adventures.blogspot.com/2008/04/nxtcamera.html"&gt; see camera blog&lt;/a&gt;)&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;quite a lot of basic documentation: and the texts on &lt;a href="http://www.mindsensors.com/"&gt;www.mindsensors.com&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;it helps a bit to know about &lt;a href="http://nxt-adventures.blogspot.com/2008/03/direct-commands-using-bluetooth-i2c.html"&gt;DIRECT COMMANDS&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;a href="http://nxtcamview.wiki.sourceforge.net/"&gt;http://nxtcamview.wiki.sourceforge.net/&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;a href="http://www.juanantonio.info/p_articles/archive/2008/LEJOS-NXJ-EBOOK.pdf"&gt;http://www.juanantonio.info/p_articles/archive/2008/LEJOS-NXJ-EBOOK.pdf&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;clock (giving a time readout, blocks available for FIRMWARE; made ourselves classes for C++ and Lejos&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;has free memory available, non volatile,  56 bytes!&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;homebrew classes for Dev-Cpp Lejos and fantom lib&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/06/psp-nx-and-lejos-java-class.html"&gt;PSP-NX&lt;/a&gt; this is not really a sensor, but a digital interface to the playstation controller, we made the Lejos JAVA class for this I2C sensor&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;(Later more about the clock, for a start here: the LEGO FIRMWARE reads it well with the block, downloaded from the link in mindsensors. Lejos JAVA: here you have to write a class for the clock, extending the I2CSensor class, using the super(SensorPort port); in your constructor, because I2CSensor is an abstract class.)&lt;br /&gt;&lt;br /&gt;see classes for lejos written out:&lt;br /&gt;&lt;a href="http://www.koders.com/info.aspx?c=ProjectInfo&amp;amp;pid=RHGY8H3PWYCG28MNNNS8V1BLGC"&gt;http://www.koders.com/info.aspx?c=ProjectInfo&amp;amp;pid=RHGY8H3PWYCG28MNNNS8V1BLGC&lt;/a&gt;)&lt;br /&gt;&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;For these extra sensors special blocks can be downloaded for use in the FIRMWARE.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;You need to make this possible: &lt;a href="http://mindstorms.lego.com/support/updates/"&gt;Dynamic Block Update&lt;/a&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;examples: &lt;a href="http://www.teamhassenplug.org/NXT/"&gt;http://www.teamhassenplug.org/NXT/&lt;/a&gt;&lt;/span&gt;&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;Then testing the time the sensors use to measure: (quite neccesary, sometimes performance depends on speed.)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul  style="font-family:arial;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;the light sensor works fast, being in the core of the NXT&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;the acceleration sensor is lowspeed, (I2C) this makes a big difference!&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;the compass is low speed, so stopping motors on a certain heading can be not too precise&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;Measurements &lt;/span&gt;(first on my laptop, using bluetooth connection, and then a lejos JAVA prog on brick)&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;comparing the times the different sensors react in combination with the software and the bluetooth.&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;//--------------------------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;//       DevCpp (small standard console prog with lib of Anders)&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;//--------------------------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;(using the fastest possible while statement, without sleep or thread)&lt;br /&gt;&lt;br /&gt;lightsensor:                  1000 times (included readout in console)         22 sec&lt;br /&gt;acceleration sensor:     1000 times  (included readout in console)         273 sec &lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;(reading only the xTilt)&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;                                            1000 times all six values                                          1640 sec (wow!)&lt;br /&gt;&lt;br /&gt;(I wrote the accel class like the other sensor classes)&lt;br /&gt;compass: &lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;                    1000 times  (included readout in console)         273 sec (exactly the same as the low speed acceleration sensor.)&lt;br /&gt;&lt;br /&gt;So with this knowledge, for instance making a balancing robot, the lightsensor should be used.&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;br /&gt;//--------------------------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;//                C#, using bluetooth connection.&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;//--------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;I used my example prog TryoutClasses, since this is a minimum setting, without having installed all kinds of sensors at the same time nor polling time&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;lightsensor                1000 times     22220 milliseconds (you would not believe this!) = 22 sec, exactly the DevCpp value&lt;br /&gt;compass sensor        1000 times     66697 milliseconds, which is faster than the DevCpp, why? Reading at double degree?&lt;br /&gt;accelleration sensor 100 times 6688&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt; milliseconds&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt; for one reading xTilt&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;accelleration sensor 100 times 40178&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt; milliseconds&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt; for six readings 3 tilts and three accelerations&lt;br /&gt;&lt;br /&gt;So in the C#, the readings of the low speed sensors seem to be faster!&lt;br /&gt;&lt;br /&gt;//--------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;//    comparing this with reading sensors in a lejos program on the brick&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;//--------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;for a prog on the brick how is this to know the elapsed time?&lt;br /&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/02/clock-sensor.html"&gt;The clock sensor! &lt;/a&gt;(This is one way)&lt;br /&gt;The internal clock. (This is another)&lt;br /&gt;&lt;br /&gt;The internal clock gives a long, which has to be cast to an int or double:&lt;br /&gt;double nowTime =  (double)System.currentTimeMillis() ;&lt;br /&gt;because this Lejos JAVA doesn't operate on long's&lt;br /&gt;&lt;br /&gt;tiltsensor xTilt() : 1000 measurements 26 sec (included &lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;displaying currentTimeMillis()&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;)&lt;br /&gt;tiltsensor 3 times xTilt, yTilt, zTilt, without displaying the elapsed time, or anything: 13 sec!&lt;br /&gt;&lt;br /&gt;lightsensor 10000 times (yes) in 4 sec&lt;br /&gt;lightsensor with displaying the value and the time on the LCD 1000 measurements: 22 sec!&lt;br /&gt;&lt;br /&gt;Conclusion: the readings of the sensors is much faster when on the brick, and the lightsensor is always faster then the tilt, other I2C sensors, like compass.&lt;br /&gt;Sonar is I2C too, but has a special connection to the ARM7 Brick processor.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;//--------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;//           putting sensors together&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;//--------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Jq__kevBr8s/R8pkOib1IoI/AAAAAAAAAvc/fa4h6mKMUNQ/s1600-h/sensors.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://4.bp.blogspot.com/_Jq__kevBr8s/R8pkOib1IoI/AAAAAAAAAvc/fa4h6mKMUNQ/s320/sensors.jpg" alt="" id="BLOGGER_PHOTO_ID_5173057322912916098" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;One of the goals is a radar device, scanning the environment and making a map, eventually following intruders in the environment he scanned.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;For this sensors had to be put together.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;The compass and the motor-degrees can be compared.&lt;br /&gt;&lt;br /&gt;The image shows a brick which is only built to trun around its axis and giving measurements. When polling this array of I2C sensors, time must be given for each measurement, as described above.&lt;br /&gt;&lt;br /&gt;(Using the bluetooth and some language on the laptop, data can be analysed easily, using the JAVA lejos, everything has to be done on the brick itself.)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;(In principle, when always orientating the brick to some main wall, the motor-degrees can be used replacing the compass. So the radar device can be made with the motor and the sonar-distance sensor.)&lt;br /&gt;&lt;br /&gt;The compass and the motor-degrees were behaving (aren't we lucky!) linearly.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;The RAM of the clock can be made useful too, storing the information gathered.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;ok to be continued................&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-3759708978637090972?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/3759708978637090972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=3759708978637090972' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/3759708978637090972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/3759708978637090972'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-sensoren.html' title='NXT sensors'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Jq__kevBr8s/R8pkOib1IoI/AAAAAAAAAvc/fa4h6mKMUNQ/s72-c/sensors.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-8161481327260283862</id><published>2008-01-26T11:47:00.000-08:00</published><updated>2008-02-14T03:48:47.562-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='BramFokke'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>NXT and C#</title><content type='html'>&lt;p&gt;Bram Fokke wrote a very useful C# prog, for steering the NXT with bluetooth, you can find it at:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://nxtsharp.fokke.net/"&gt;http://nxtsharp.fokke.net/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;I transformed and added this basic design and use this prog to connect to the NXT from a website or even from Second Life! Through PHP my server has the neccassary dBAse for moto and senosr values. These are asked for by the prog and send to the brick by bluetooth.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;In C# adding a browser is so easy! But the Bram Fokke prog uses quite a lot of his own classes, the structure is not very clearly visible if you are coming to C# for the first time, so i made a little demo program in C#, doing things with button, having it's class in a namespace, and thirdly connecting to the NXT (choosing a ComPort) and playing a sound in the brick. &lt;a href="http://www.contrechoc.com/nxt/tryoutClasses.zip"&gt;Download.&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;In the Bram Fokke prog i added sliders to change the motorpower and added buttons to connect and disconnect. This altered the structure of the program (which connected on running) so i have to do some extra errorchecking on the motor buttons, not doing anything when not connected.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The disadvantage of the website - server - bluetooth connection is that is becomes rather slow... dont drive your own car like this!&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;img src="http://www.contrechoc.com/nxt/steering.jpg" alt="" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So this is how the program looks now...&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-via-een-webpagina.html"&gt;NXT remote steering&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-8161481327260283862?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/8161481327260283862/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=8161481327260283862' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/8161481327260283862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/8161481327260283862'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-en-c.html' title='NXT and C#'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-799934897800085468</id><published>2008-01-26T11:45:00.000-08:00</published><updated>2008-03-08T04:59:05.309-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='visual C++'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>NXT visual C++ Express</title><content type='html'>&lt;p&gt;The  library of Anders (see other blogs for link) runs without problems in Dev Cpp.&lt;/p&gt;&lt;p&gt;But Dev Cpp is really "old style" great for fast experimenting (several times i went back to it, for instance for writing the clock sensor class) but more cool environments are available free..&lt;/p&gt;&lt;p&gt;That is why i present here an example in Visual C++ Express, running with a few class coming from Anders library. &lt;/p&gt;&lt;p&gt;Dont forget to add  #include "stdafx.h" everywhere.&lt;/p&gt;&lt;p&gt;In the serial.cpp i had to change   CreateFile in CreateFileA.&lt;/p&gt;&lt;p&gt;You must get used to the way Visual C++ links classes....&lt;br /&gt;&lt;/p&gt;&lt;p&gt;download the example &lt;a href="http://www.contrechoc.com/nxt/Visual%20C++%20Express%20voorbeeld.zip"&gt;Visual C++ Express voorbeeld.zip&lt;/a&gt;&lt;/p&gt;&lt;p&gt;explore and be creative!&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-799934897800085468?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/799934897800085468/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=799934897800085468' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/799934897800085468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/799934897800085468'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-visual-c-express.html' title='NXT visual C++ Express'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-3418841039348973813</id><published>2008-01-26T11:40:00.000-08:00</published><updated>2008-03-01T06:30:16.133-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='devCpp'/><category scheme='http://www.blogger.com/atom/ns#' term='bluetooth'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>NXT and DevCpp</title><content type='html'>&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;Dev Cpp, free to download.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;here a page to help installing Dev Cpp: &lt;a href="http://www.uniqueness-template.com/devcpp/"&gt;http://www.uniqueness-template.com/devcpp/&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;Using &lt;a href="http://www.norgesgade14.dk/bluetoothlibrary.php"&gt;the library of Anders&lt;/a&gt;, this is a great way to experiment, because the structure stays very simple, unlike the C# skyscraper.&lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;a href="http://www.norgesgade14.dk/bluetoothlibrary.php"&gt;http://www.norgesgade14.dk/bluetoothlibrary.php&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;With the library of Anders, bluetooth and all kind of non standard sensors can be tested.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;I used it in the console window.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;I added an openGL environment which also works fine.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;To get a notion of the speed of the sensors, I used  DevCpp in comparison with  C#.&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-sensoren.html"&gt; See sensors&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="text-decoration: underline;font-size:85%;" &gt;Example: &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;a href="http://www.contrechoc.com/nxt/Dev%20Cpp%20voorbeeld.zip"&gt;Dev Cpp voorbeeld.zip&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;In the Anders library examples are included.&lt;span&gt; &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-3418841039348973813?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/3418841039348973813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=3418841039348973813' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/3418841039348973813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/3418841039348973813'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-devcpp.html' title='NXT and DevCpp'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-3743772573972647643</id><published>2008-01-26T11:39:00.000-08:00</published><updated>2008-03-08T04:55:40.622-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firmware'/><category scheme='http://www.blogger.com/atom/ns#' term='blockeditor'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>Firmware revisited</title><content type='html'>&lt;p&gt;Making programmes in the FIRMWARE is easy and difficult at the same time! Making small programmes to test sensors is done intuitively and works fine. Trying to programme in the way a programmer works in C++ or JAVA is difficult. With the FIRMWARE you have to develope another strategy of programming.&lt;/p&gt;&lt;br /&gt;New sensors: for these sensors there are new "block" to be downloaded. For this, the FIRMWARE itself needs to be updated:&lt;br /&gt;&lt;p&gt;&lt;a href="http://mindstorms.lego.com/Support/Updates/"&gt;http://mindstorms.lego.com/Support/Updates/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;A nice feature of the FIRMWARE is that you can make blocks yourself! By selecting a part of your FIRMWARE program and using the blockeditor: under menu-&gt;edit you find Make a new myBlock, the My Block Builder windows opens, you can define or make an icon for your new block.&lt;/p&gt;&lt;p&gt;Usefull new blocks, made with a special block editor can be found at:&lt;a href="http://mindstorms.lego.com/Support/Updates/"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;a href="http://www.teamhassenplug.org/NXT/"&gt;http://www.teamhassenplug.org/NXT/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;What i find difficult is the use of Variables in FIRMWARE. Under Menu-&gt; Edit you are able to define a variable, there is a block called Variable ( a suitcase) but writing to it, or reading it, or changing it was not really obvious to me. So for what i needed, i programmed around the use of Variables!&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-3743772573972647643?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/3743772573972647643/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=3743772573972647643' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/3743772573972647643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/3743772573972647643'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/firmware-revisited.html' title='Firmware revisited'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-2546828725155480965</id><published>2008-01-26T11:36:00.000-08:00</published><updated>2008-04-14T23:19:16.526-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firmware'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='visual C++'/><category scheme='http://www.blogger.com/atom/ns#' term='languages'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>NXT Tower of Babylon</title><content type='html'>&lt;span style=";font-family:arial;font-size:85%;"  &gt;The NXT is a programmable robot, so which language do you want to use?&lt;br /&gt;Many around!&lt;br /&gt;&lt;a href="http://www.teamhassenplug.org/NXT/NXTSoftware.html"&gt;a big comparison table can be found here.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-size:130%;" &gt;FIRMWARE:&lt;/span&gt;&lt;br /&gt;The language coming with the NXT is the FIRMWARE of Lego. Programming is done with drag and drop of elements. With this language the basic functions can be explored. It gets more interesting when you make your own blocks, but in the end some features of normal programming, like easily introducing new variables is somewhat cumbersome.&lt;br /&gt;Good for: testing.&lt;br /&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/firmware-revisited.html"&gt;more about FIRMWARE&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;JAVA&lt;/span&gt; &lt;/span&gt;can be done in the &lt;a href="http://lejos.sourceforge.net/"&gt;Lejos JAVA&lt;/a&gt;.&lt;br /&gt;Programming is possible in a text document and compiling and transmitting can be done from the COMMAND WINDOW. But easier is to use a roundabout with ECLIPSE. ECLIPSE is a bit cumbersome to install and link with the Lejos libs, but in the end it is value for money (because it is free :-) and it helps a lot avoiding mistakes in programming.&lt;br /&gt;The JAVA is transmitted to the NXT using USB or Bluetooth, all from ECLIPSE.&lt;br /&gt;&lt;a href="http://lejos.sourceforge.net/p_technologies/nxt/nxj/api/"&gt;description API of Lejos&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;a href="http://www.koders.com/java/fidDB9074872E29742A4633D5D6052EF35DE7E0A9F6.aspx"&gt;Koders&lt;/a&gt; &lt;/span&gt;&lt;span style="font-size:85%;"&gt;Very important: the sourcecode of the classes can be found here!&lt;br /&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-lejos-fileio.html"&gt;FilIO on the brick in lejos &lt;/a&gt;: an example used in eclipse&lt;br /&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/02/nxt-lejos-array-and-arraylist.html"&gt;Lejos Java and the arraylist: &lt;/a&gt;an example using an extra class and using the arraylist&lt;br /&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/02/nxt-and-lejos-fun.html"&gt;abstract classes  and a long&lt;/a&gt;: building on the I2C abstract class and making a double from a long&lt;br /&gt;There are quite a few &lt;a href="http://undergraduate.csse.uwa.edu.au/units/670.104/resources/LEJOS.README.html"&gt;limitations, look carefully at this list&lt;/a&gt;. (Search limitations)&lt;br /&gt;&lt;br /&gt;latest about Lejos and robotics: &lt;a href="http://www.juanantonio.info/p_articles/archive/2008/LEJOS-NXJ-EBOOK.pdf"&gt;ebook by Juan Antonio Brena Moral&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(255, 0, 0);font-size:130%;" &gt;C++ &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Dev-CPP &lt;/span&gt;can be used too, running on the laptop, using bluetooth actually sending DIRECT COMMANDS to the brick. The libs I used and expanded are coming from Anders. (see Table)&lt;br /&gt;I use Dev Cpp in the console mode for basic testing, for instance of the sensors.&lt;br /&gt;I use Dev Cpp also with OpenGL to be able to draw the environment of the brick (using the sonar sensor).&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Microsof Visual C++&lt;/span&gt; works fine too, using his Anders classes, with a few alterations.&lt;br /&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-visual-c-express.html"&gt;an example in C++&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;An independant and semi commercial lib is the &lt;span style="color: rgb(255, 0, 0);"&gt;RobotC&lt;/span&gt;. This is very nice seeming to run on the brick and the PC at the same time. You can use it a month for evaluation. I continued with the free available libs Dev-Cpp, ECLIPSE and C#, so no further experience. Many examples can be found on the web.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(255, 0, 0);font-size:130%;" &gt;C#&lt;/span&gt; of Microsoft Visual Express, can be used, with the lib of Bram Fokke, see table. I have expanded and rewritten this lib and the features of Visual Express, coming free are really great (webbrowser and toolbox for instance, i used this for steering the NXT from the web and from Second Life.)&lt;br /&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-en-c.html"&gt;The modified Bram Fokke steering&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;table  border="1" cellpadding="2" cellspacing="2" style="font-family:arial;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Language&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; Editor&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;where?&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; features&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Costs&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; source&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Firmware &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Lego Mindstorms CD &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; in Brick&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; drag &amp;amp; drop (USB bluetooth versturen)&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;comes with buying the NXT&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt; &lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; JAVA/lejos&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; Eclipse&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; in Brick&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; (USB bluetooth versturen)&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; free&lt;/span&gt;&lt;/td&gt;&lt;td&gt; &lt;span style="font-size:85%;"&gt;&lt;a href="http://lejos.sourceforge.net/"&gt;http://lejos.sourceforge.net/ &lt;/a&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; C++&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; Dev++&lt;br /&gt;Lid of Anders&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; in PC/bluetooth&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; Console/Windows appl (Bluetooth Direct Commands)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; free&lt;/span&gt;&lt;/td&gt;&lt;td&gt; &lt;span style="font-size:85%;"&gt;&lt;a href="http://www.norgesgade14.dk/bluetoothlibrary.php"&gt;http://www.norgesgade14.dk/bluetoothlibrary.php&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; C#&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;  NXT C#/ Visual C#&lt;br /&gt;Lib of Bram Fokke&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;  in PC/bluetooth&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; Console/Windows appl&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; free&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; Visual C# Express - &lt;a href="http://nxtsharp.fokke.net/"&gt;http://nxtsharp.fokke.net/ &lt;/a&gt;&lt;/span&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt; &lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt; &lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt; &lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt; &lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt; &lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;a href="http://www.robotc.net/"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; RobotC&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; RobotC editor&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; in PC/bluetooth&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt; runtime debugging, showing all regsiters&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;When RobotC is in the brick, sending bluetooth is hindered&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt; 30$&lt;/span&gt;&lt;/td&gt;&lt;td&gt; &lt;span style="font-size:85%;"&gt;&lt;a href="http://www.robotc.net/"&gt;http://www.robotc.net/&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p style="font-family: arial;"&gt; &lt;/p&gt;&lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;There are other languages like NQC, not quite C and Ruby for instance, i have not done too much with these languages at the moment.&lt;/span&gt;&lt;/p&gt;&lt;p style="font-family: arial;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-2546828725155480965?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/2546828725155480965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=2546828725155480965' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2546828725155480965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2546828725155480965'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-toren-van-babylon.html' title='NXT Tower of Babylon'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-2921158700146014628</id><published>2008-01-26T11:34:00.000-08:00</published><updated>2008-03-02T09:32:19.054-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lejos'/><category scheme='http://www.blogger.com/atom/ns#' term='fileIO'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>nxt lejos fileIO</title><content type='html'>Writing data to a file on the brick  (in the JAVA of lejos ) is possible, this is an example of how it can be done:&lt;br /&gt;&lt;p&gt;(The JAVA running on the NXT is not as powerful as normal JAVA, some classes cannot be used.)&lt;/p&gt;&lt;p&gt;//file exists? when not: make it:&lt;/p&gt;&lt;p&gt;File file1 = new File("tryout.txt" ) ;&lt;br /&gt;   if (! file1.exists() )&lt;br /&gt;        file1.createNewFile();&lt;/p&gt;&lt;p&gt; //writing 2 bytes to the file&lt;br /&gt;&lt;/p&gt;&lt;p&gt;FileOutputStream filestream = new FileOutputStream( file1 );&lt;br /&gt;   filestream.write(43);&lt;br /&gt;   filestream.write(22);&lt;br /&gt;   filestream.close();&lt;/p&gt;&lt;p&gt;// write() en close() in the FileOutputStream class are available&lt;br /&gt;&lt;/p&gt;&lt;p&gt;//read back the bytes and put them on the screen NXT&lt;/p&gt;&lt;p&gt; FileInputStream fileInstream = new FileInputStream( file1 );&lt;br /&gt;             LCD.drawInt(   fileInstream.read(),5,5 );&lt;br /&gt;             LCD.drawInt(   fileInstream.read(),5,7 );&lt;br /&gt;             fileInstream.close();&lt;/p&gt;&lt;p&gt;//available are the methods read() en reset() in the FileInStream class  &lt;/p&gt;---------------------------------------------------------------&lt;br /&gt;when stored data from the sensors, these data can be read back like this:&lt;br /&gt;&lt;br /&gt;public static void reportFile (File filex)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;//input de fileName&lt;br /&gt;//output on the LCD screen in two colums&lt;br /&gt;&lt;br /&gt;   LCD.drawString("start",0, 0 );&lt;br /&gt;   try {&lt;br /&gt;       //open inputstream&lt;br /&gt;     FileInputStream fileInstream = new FileInputStream( filex );&lt;br /&gt;     int testByte = fileInstream.read();&lt;br /&gt;    &lt;br /&gt;     int uy = 0;&lt;br /&gt;     int ux = 0;&lt;br /&gt;     //make the values appear on screen in columns&lt;br /&gt;     while ( testByte != -1 )&lt;br /&gt;      {&lt;br /&gt;         LCD.drawInt(   testByte, ux, 2 + (uy++) );&lt;br /&gt;&lt;br /&gt;          testByte = fileInstream.read(  );&lt;br /&gt;&lt;br /&gt;          if (uy&gt;3)&lt;br /&gt;              {&lt;br /&gt;              ux+=3;&lt;br /&gt;              uy=0;&lt;br /&gt;              }&lt;br /&gt;      }&lt;br /&gt;     //finish&lt;br /&gt;     LCD.drawString("finished",0, 7 );&lt;br /&gt;     fileInstream.close();&lt;br /&gt;     LCD.refresh();&lt;br /&gt;   } catch (IOException ioe) { LCD.drawString("IO Exception", 0, 0);     }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;To be explored: Can this file be downloaded to the laptop?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-2921158700146014628?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/2921158700146014628/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=2921158700146014628' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2921158700146014628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2921158700146014628'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/nxt-lejos-fileio.html' title='nxt lejos fileIO'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-4293755515898836954</id><published>2008-01-26T11:33:00.000-08:00</published><updated>2008-12-10T02:07:55.465-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='lejos'/><category scheme='http://www.blogger.com/atom/ns#' term='installation'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>Installing JAVA and Eclipse (without bluetooth)</title><content type='html'>&lt;table style="width: 637px; height: 101px; text-align: left; margin-left: auto; margin-right: auto; color: rgb(204, 0, 0);" border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;ul&gt;&lt;li&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;Good news: available since 18 march 2008: an ECLIPSE PLUGIN for the Lejos&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;&lt;a href="http://lejos.sourceforge.net/"&gt;http://lejos.sourceforge.net/&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt; &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;installing lejos in Netbeans, link:&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;&lt;a href="http://homepages.feis.herts.ac.uk/%7Ecomqdhb/lego/netbeans.php"&gt;http://homepages.feis.herts.ac.uk/~comqdhb/lego/netbeans.php&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;Why &lt;span style="font-weight: bold;"&gt;not &lt;/span&gt;want to use the firmware of Lego?&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Firmware is good to test some simple ideas and getting a notion of the sensors&lt;/li&gt;&lt;li&gt;Firmware  becomes cumbersome when really programming around, for instance using variables&lt;/li&gt;&lt;li&gt;(but dont forget: some people really do marvellous things in the firmware!)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;All kinds of other possibilities (C, C++, C#, NQT, Ruby), nearly too much.&lt;br /&gt;&lt;br /&gt;In this blog we present some experiences with the Lejos, Java library, later on experiments in C++ and C#, and the fantom lib.&lt;br /&gt;&lt;br /&gt;This intro is added lately on the sourceforge site: &lt;a href="http://lejos.sourceforge.net/tutorial/index.html"&gt;http://lejos.sourceforge.net/tutorial/index.html&lt;/a&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Beware: the lejos-JAVA is reduced, sometimes Eclipse accepts something which fails in the brick, see limitations of Lejos.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;but: now we can programme!&lt;/li&gt;&lt;ul&gt;&lt;li&gt;classes&lt;/li&gt;&lt;li&gt;arrays&lt;/li&gt;&lt;li&gt;input output&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;Installing Lejos and Eclipse is quite an undertaking! This is not really a quickstart.&lt;br /&gt;&lt;p&gt;Slowstart (see also other pages on the web)&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Download Java for Mindstorms NXT:  &lt;a href="http://lejos.sourceforge.net/"&gt;http://lejos.sourceforge.net/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;(JAVA JDK is installed? Don't forget about paths, don't forget about the naming conventions without spaces in the folder names for JDK)&lt;/li&gt;&lt;li&gt;&lt;span style="text-decoration: underline;"&gt;You can programm JAVA lejos from the command window, some people say this is better to learn JAVA, but programming becomes more comfortable in  &lt;/span&gt;&lt;a href="http://eclipsediscovery.yoxos.com/discovery/rap?gclid=CPr-5qmP-o4CFQqHMAodTzXquA"&gt;Eclipse&lt;/a&gt;, (at a certain price: starting it up!)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;JAVA JDK, Lejos and Eclipse, are three parts which have to come togehter&lt;br /&gt;&lt;p&gt;This description is ok: ('bartneck') : &lt;a href="http://www.bartneck.de/work/education/masterClassLego/javaInstallNXT/index.html"&gt;http://www.bartneck.de/work/education/masterClassLego/javaInstallNXT/index.html&lt;/a&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;to transfer data, a program to the brick, also downlaod and install LIBUSB&lt;br /&gt;&lt;/li&gt;&lt;li&gt;environmental variables, for everybody a bit different depending on the placing of JDK and Lejos.&lt;/li&gt;&lt;ul&gt;&lt;li&gt; 'this computer', 'properties', 'advanced', 'environmental variables',&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Jq__kevBr8s/R7KkuwB2zsI/AAAAAAAAAtM/EiuoQ1RiX9M/s1600-h/mi6.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_Jq__kevBr8s/R7KkuwB2zsI/AAAAAAAAAtM/EiuoQ1RiX9M/s320/mi6.jpg" alt="" id="BLOGGER_PHOTO_ID_5166372845621006018" border="0" /&gt;&lt;/a&gt;Warning: Dont put the JDK in the folder named "Program Files" this contains a space and can be a problem for JAVA.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;System variabels&lt;br /&gt;&lt;/li&gt;&lt;li&gt;testing the Lejos in the  commandwindow, ('bartneck')&lt;br /&gt;&lt;/li&gt;&lt;li&gt;ECLIPSE and lejos configuring  ('bartneck')&lt;br /&gt;&lt;/li&gt;&lt;li&gt;in the running project in ECLIPSE mind the  BUILD PATH!&lt;/li&gt;&lt;/ul&gt;(ECLIPSE uses external jars but also in the nxj.bat file it searches the CLASSPATH, using the environmental variables, what is the difference? While all worked well, for use of JAVA progs transmitted to the brick, I got a persistent error trying to compile something using icommand...not finding the icommand.jar while it was in the CLASSPATH and even in BUILDPATH...)&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;Checking: &lt;/p&gt;&lt;ul&gt;&lt;li&gt;in  commandwindow type: lejosdl and it has to show a list of options (see &lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-commandwindow-met-lejos.html"&gt;special on commandwindow&lt;/a&gt;)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;img src="http://blackboard.hsleiden.nl/webapps/lobj-wiki-bb_bb60/wiki_home/Handler/1190381733625-1357793156--933059589/Home?cmd=GetImage&amp;amp;systemId=mi5__0.jpg" alt="" /&gt;&lt;/li&gt;&lt;li&gt;ECLIPSE compiles the JAVA, finding the lejos libraries&lt;/li&gt;&lt;li&gt;at last transferring the program to the brick using USB, the brick gives a signal&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;After connecting:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;wait three seconds, after Windows gives the USB connect beep, before compiling and transferring&lt;/li&gt;&lt;/ul&gt;&lt;span style="" lang="EN-US"&gt;&lt;span style="font-size:100%;"&gt;//--------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;some other features:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;USB uploading ok: start the file by switching to the file and executing it.&lt;/li&gt;&lt;li&gt;but using bluetooth (to transmit the program) it can already be running too!&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;depending on how you have written your program it can be on and waiting for you, without showing anything, spoiling its batteries.&lt;/li&gt;&lt;li&gt;so to prevent this programme something to show a message on the LCD screen&lt;/li&gt;&lt;/ul&gt;&lt;span style="" lang="EN-US"&gt;&lt;span style="font-size:100%;"&gt;//--------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;if there is an unchecked exception in th program or other wrong things the LCD screen displays the error, and the brick is not to be shut off. Reset it!&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;problem:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;from ECLIPSE, compiling/uploading (USB)...in the console window of Eclipse: Bluetooth not found, ok you started too quickly uploading&lt;/li&gt;&lt;/ul&gt;&lt;span style="" lang="EN-US"&gt;&lt;span style="font-size:100%;"&gt;//--------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;emulator&lt;/p&gt;&lt;ul&gt;&lt;li&gt;an emulator could be super, but really because you have to build your own robot, it doesn't make much sense!&lt;/li&gt;&lt;/ul&gt;&lt;span style="" lang="EN-US"&gt;&lt;span style="font-size:100%;"&gt;//--------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;In &lt;a href="http://undergraduate.csse.uwa.edu.au/units/670.104/resources/LEJOS.Install.Instructions.pdf"&gt;this document describing the installation of Lejos&lt;/a&gt; i found this warning:&lt;br /&gt;&lt;p style="color: rgb(153, 0, 0);" class="MsoNormal"&gt;&lt;span  lang="EN-US" style="font-size:100%;"&gt;Warning:&lt;/span&gt;&lt;/p&gt;  &lt;span style="" lang="EN-US"&gt;&lt;span style="color: rgb(153, 0, 0);font-size:100%;" &gt;There is a theoretical limit to the number of times you can replace the firmware on your NXT before it wears out. Every time you replace the firmware, a piece of data called a lock bit is used up. This bit is rated to work 100 times (minimum) before it expires. However, don’t let this dissuade you from replacing the firmware with something you want more. Most engineers agree that the lock bit will last far in excess of 100 times. Chances are you will never even notice this limitation and you probably won’t replace your firmware enough to approach even 100.&lt;br /&gt;&lt;br /&gt;That is bad news? Why "wear out" the brick????? Anyone suffered this?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;//--------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;TESTING installation: (functioning of lejos in &lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-commandwindow-met-lejos.html"&gt;Command Window&lt;/a&gt;)&lt;br /&gt;ok: &lt;a href="http://legolab.daimi.au.dk/DigitalControl.dir/Lejos_NXJ.dir/lejos_nxj_install_guide.html"&gt;another page for installing&lt;/a&gt;, with a good test: see under number 9 on this page&lt;br /&gt;This page has a special on installing Lejos in Eclipse.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-4293755515898836954?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/4293755515898836954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=4293755515898836954' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/4293755515898836954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/4293755515898836954'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/installeren-java-en-eclips.html' title='Installing JAVA and Eclipse (without bluetooth)'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Jq__kevBr8s/R7KkuwB2zsI/AAAAAAAAAtM/EiuoQ1RiX9M/s72-c/mi6.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-2207647119070741332</id><published>2008-01-26T11:31:00.000-08:00</published><updated>2008-03-02T09:26:49.531-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='quickstart'/><category scheme='http://www.blogger.com/atom/ns#' term='firmware'/><category scheme='http://www.blogger.com/atom/ns#' term='programme'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>quickstart firmware</title><content type='html'>&lt;p&gt;&lt;img src="http://blackboard.hsleiden.nl/webapps/lobj-wiki-bb_bb60/wiki_home/Handler/1190381733625-1357793156--933059589/Home?cmd=GetImage&amp;amp;systemId=mi1__0.jpg" alt="" /&gt; &lt;/p&gt;&lt;p&gt;a good description of the NXT can be found in the wikipedia: &lt;a href="http://en.wikipedia.org/wiki/Lego_Mindstorms"&gt;http://en.wikipedia.org/wiki/Lego_Mindstorms&lt;/a&gt;&lt;/p&gt;&lt;p&gt;This entry also gives a list of languages to programm the bot, besides the drag and drop FIRMWARE of Lego, coming with the box.&lt;/p&gt;&lt;p&gt;------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- &lt;/p&gt;&lt;p&gt;This is really a  &lt;img src="http://blackboard.hsleiden.nl/webapps/lobj-wiki-bb_bb60/editor/plugins/emotions/images/smiley-laughing.gif" alt="Laughing" title="Laughing" border="0" /&gt;uickstart , you can built a robot in no time, and experiment with small prog's.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;actually without building anything: attach sensors and fool atound with the sample program's already installed with the FIRMWARE.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Somehow all these legoparts must be put together, there is a special collection of parts which you can use to construct the simple TriBot in 30 minutes! Starting in the small book.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;In the bigger book, parts and sensors are added to give yo&lt;/li&gt;&lt;li&gt;when you really programme the drag and drop feels clumsy, but it has more hidden features, for instance making your own blocks which make it more interesting.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;But in the end you can better choose a "language", then there is a whole spectrum:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;JAVA, free Lejos software for running on the brick: &lt;a href="http://lejos.sourceforge.net/"&gt;http://lejos.sourceforge.net/&lt;/a&gt; &lt;/li&gt;&lt;li&gt;RobotC, C: &lt;a href="http://www.robotc.net/index.htm"&gt;http://www.robotc.net/index.htm&lt;/a&gt; , with the advantage of convenient debugging possibilities (30US$)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Not Quite C, (not yet tried) &lt;a href="http://bricxcc.sourceforge.net/nqc/"&gt;http://bricxcc.sourceforge.net/nqc/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;later on, in bluetooth mode you can rely on your laptop power for intance  the lib of Anders &lt;a href="http://www.norgesgade14.dk/bluetoothlibrary.php"&gt;http://www.norgesgade14.dk/bluetoothlibrary.php&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-2207647119070741332?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/2207647119070741332/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=2207647119070741332' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2207647119070741332'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/2207647119070741332'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/quickstart-firmware.html' title='quickstart firmware'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-516495489023883673.post-7078432660005387616</id><published>2008-01-26T11:29:00.000-08:00</published><updated>2008-12-10T02:07:55.794-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='main'/><category scheme='http://www.blogger.com/atom/ns#' term='menu'/><category scheme='http://www.blogger.com/atom/ns#' term='nxt'/><title type='text'>Main menu</title><content type='html'>&lt;div class="contentItemTitle"&gt;MINDSTORMS NXT&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Jq__kevBr8s/SFiqnlkVGNI/AAAAAAAAAzc/UWDGyIPsWr4/s1600-h/12.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_Jq__kevBr8s/SFiqnlkVGNI/AAAAAAAAAzc/UWDGyIPsWr4/s320/12.jpg" alt="" id="BLOGGER_PHOTO_ID_5213104165757458642" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div dir="ltr"&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/quickstart-firmware.html"&gt;some introduction and installing&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;building and programming using the FIRMWARE&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;-------- software ---------------------------&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/installeren-java-en-eclips.html"&gt;JAVA/ECLIPSE (Lejos) installing&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-lejos-fileio.html"&gt;lejos: useful example: FILEIO for storing and reading data on the NXT&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-toren-van-babylon.html"&gt;C++, C#, CRobot, etc etc etc&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/firmware-revisited.html"&gt;more about the FIRMWARE&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-devcpp.html"&gt;Dev Cpp&lt;/a&gt; ( lib of Anders, with bluetooth and direct commmands)&lt;/li&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-visual-c-express.html"&gt;Visual c++ Express basis example &lt;/a&gt;(met bluetooth, direct commmands)&lt;/li&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-en-c.html"&gt;C# visual express of Bram Fokke&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;----------------------- sensoren---------------------------------------&lt;ul&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-sensoren.html"&gt;sensors (capteurs)&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;to be done: uncommon use of sensors&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;-------------------- afstandsbediening---------------------------------&lt;ul&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-bluetooth.html"&gt;bluetooth &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-en-de-wii-remote-control.html"&gt;Wii remote steering&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-via-een-webpagina.html"&gt;steering via HTML &lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;-------------------- modellen----------------------------------&lt;ul&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-als-turtlebot.html"&gt;first examples and experiments&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-basismodel.html"&gt;a scorpion with creative legs&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-bike.html"&gt;a bicycle, not yet driving&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;to be done: a skiing brick without problems of snow&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://blackboard.hsleiden.nl/webapps/lobj-wiki-bb_bb60/wiki_home/Handler/1190381733625-1357793156--933059589/1178bcb6d560.94d2feca1ee9d?cmd=GetPage"&gt;a rowing robot on dry land&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://blackboard.hsleiden.nl/webapps/lobj-wiki-bb_bb60/wiki_home/Handler/1190381733625-1357793156--933059589/1178bd092d70.9b205a2fc5c7e8?cmd=GetPage"&gt;radar  'sepsem' with dog: in czech!&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="text-decoration: underline;"&gt;a balancing robot, first failures&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;--------- miscellaneous---------------------&lt;ul&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-en-harde-data-met-de-lejos-classes.html"&gt;hard data&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-en-harde-data-met-de-lejos-classes.html"&gt;Log&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-troubleshooting.html"&gt;troubleshooting&lt;/a&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-commandwindow-met-lejos.html"&gt;command window&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-lejos-en-environmetal-variables.html"&gt;environmental variables&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://nxt-adventures.blogspot.com/2008/01/nxt-webfun.html"&gt;(external) webpages with info, examples.&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;p&gt;&lt;img src="http://www.contrechoc.com/nxt/nxt.jpg" alt="" height="229" width="415" /&gt; &lt;/p&gt;&lt;br /&gt;  &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/516495489023883673-7078432660005387616?l=nxt-adventures.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://nxt-adventures.blogspot.com/feeds/7078432660005387616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=516495489023883673&amp;postID=7078432660005387616' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7078432660005387616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/516495489023883673/posts/default/7078432660005387616'/><link rel='alternate' type='text/html' href='http://nxt-adventures.blogspot.com/2008/01/hoofdmenu.html' title='Main menu'/><author><name>underCover</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Jq__kevBr8s/SFiqnlkVGNI/AAAAAAAAAzc/UWDGyIPsWr4/s72-c/12.jpg' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
