aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus2011-07-06 16:01:41 +0000
committermarcus2011-07-06 16:01:41 +0000
commit82216e9db97c857b0ebc0240a1eae5d9f9b0c0fe (patch)
treec1cd5cb7f7992aec0822c79e86a5023d7b3fac48
parent6222948850b5528eaf9763ccf997df412e6919c6 (diff)
Fixed nxt_test to use find_one_brick, tweaked a few other things.
-rw-r--r--README4
-rw-r--r--examples/cnc.py2
-rw-r--r--scripts/nxt_filer2
-rw-r--r--scripts/nxt_push2
-rw-r--r--scripts/nxt_test43
5 files changed, 24 insertions, 29 deletions
diff --git a/README b/README
index c1a8799..ec88f63 100644
--- a/README
+++ b/README
@@ -85,6 +85,8 @@ Specific Stability Status:
On Linux: Stable; well tested with both pybluez and lightblue.
On Windows: Stable; working last I checked.
On Mac: Some users having problems.
+ Internet Communications System (nxt.ipsock)
+ Seems to work for the most part. Occasionally has hiccups.
Fantom Communications System (nxt.fantomsock)
On Linux: N/A (Fantom driver not supported)
On Windows: Not tested.
@@ -95,7 +97,7 @@ Specific Stability Status:
Stable except for Synchronized Motor support, which is experimental at
this stage and has not been extensively tested.
nxt.sensor:
- Code not specific to a particular sensor is well tested and working
+ Code not specific to a particular sensor is well-tested and working
great. More than half of the sensor classes were last reported working;
the rest have not to my knowlege been tested and were written blindly
from the manuacturers' specifications.
diff --git a/examples/cnc.py b/examples/cnc.py
index 9b5c5b1..0a44379 100644
--- a/examples/cnc.py
+++ b/examples/cnc.py
@@ -7,7 +7,7 @@
#http://groups.google.com/group/nxt-python/browse_thread/thread/f6ef0865ae768ef
import nxt, thread, time
-b = nxt.find_one_brick(name = 'MyNXT')
+b = nxt.find_one_brick()
mx = nxt.Motor(b, nxt.PORT_A)
my = nxt.Motor(b, nxt.PORT_B)
motors = [mx, my]
diff --git a/scripts/nxt_filer b/scripts/nxt_filer
index c933550..01e7f64 100644
--- a/scripts/nxt_filer
+++ b/scripts/nxt_filer
@@ -141,7 +141,7 @@ if __name__ == '__main__':
Usage: nxt_filer [--host <macaddress>]'''
exit(0)
- brick = nxt.locator.find_one_brick(keyword_arguments['host'])
+ brick = nxt.locator.find_one_brick(keyword_arguments.get('host',None))
win = NXT_Filer(brick)
win.show_all()
gtk.main()
diff --git a/scripts/nxt_push b/scripts/nxt_push
index 8f2c7c6..6a0f9ab 100644
--- a/scripts/nxt_push
+++ b/scripts/nxt_push
@@ -47,6 +47,6 @@ if __name__ == '__main__':
Usage: nxt_push [--host <macaddress>] <file>'''
exit(0)
- brick = nxt.locator.find_one_brick(keyword_arguments['host'])
+ brick = nxt.locator.find_one_brick(keyword_arguments.get('host',None))
for filename in arguments:
write_file(brick, filename)
diff --git a/scripts/nxt_test b/scripts/nxt_test
index 16eed5b..0640b94 100644
--- a/scripts/nxt_test
+++ b/scripts/nxt_test
@@ -12,28 +12,21 @@ Usage: nxt_test (takes no arguments except --help)'''
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!"
+try:
+ b = nxt.locator.find_one_brick()
+ 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 while running test:"
+ traceback.print_tb(sys.exc_info()[2])
+ print str(sys.exc_info()[1])
+ if b:
+ b.sock.close()