summaryrefslogtreecommitdiff
path: root/AT91SAM7S256/armdebug/nxt-python-fantom/scripts/nxt_test
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-03-01 17:01:37 +0800
committerTat-Chee Wan (USM)2011-03-01 17:01:37 +0800
commita85e78c4532ad1e9d7c8282334280db5e700b7f0 (patch)
treecfcbf734bb146b8531304e912d91114e914ff831 /AT91SAM7S256/armdebug/nxt-python-fantom/scripts/nxt_test
parenteae3f8bdb3de377d5e303bffb84238f0d86beee2 (diff)
parent2234d3c1cae095a3a450e7c5bbf0c7b89bb6c346 (diff)
Merge branch 'master' of ssh://svc.cs.usm.my/~/gitrepo-bare/armdebug
Diffstat (limited to 'AT91SAM7S256/armdebug/nxt-python-fantom/scripts/nxt_test')
-rw-r--r--AT91SAM7S256/armdebug/nxt-python-fantom/scripts/nxt_test33
1 files changed, 33 insertions, 0 deletions
diff --git a/AT91SAM7S256/armdebug/nxt-python-fantom/scripts/nxt_test b/AT91SAM7S256/armdebug/nxt-python-fantom/scripts/nxt_test
new file mode 100644
index 0000000..5cc0fcd
--- /dev/null
+++ b/AT91SAM7S256/armdebug/nxt-python-fantom/scripts/nxt_test
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+#Lists various information from all bricks it can connect to.
+
+import sys, traceback
+import nxt.locator
+import nxt.brick
+
+b = None
+socks = nxt.locator.find_bricks()
+for sock in socks:
+ try:
+ b = sock.connect()
+
+ name, host, signal_strength, user_flash = b.get_device_info()
+ print 'NXT brick name: %s' % name
+ print 'Host address: %s' % host
+ print 'Bluetooth signal strength: %s' % signal_strength
+ print 'Free user flash: %s' % user_flash
+ prot_version, fw_version = b.get_firmware_version()
+ print 'Protocol version %s.%s' % prot_version
+ print 'Firmware version %s.%s' % fw_version
+ millivolts = b.get_battery_level()
+ print 'Battery level %s mV' % millivolts
+ except:
+ print "Error with brick:"
+ traceback.print_tb(sys.exc_info()[2])
+ print str(sys.exc_info()[1])
+ if b:
+ b.sock.close()
+
+if not b:
+ print "No bricks found!"