Comments (7)
Did some experimenting with this..
Wrote this program. Got "16" back with some data!
import nxt.locator
import nxt.sensor.generic
brick = nxt.locator.find()
sensor = brick.get_sensor(nxt.sensor.Port.S1, nxt.sensor.generic.BaseDigitalSensor)
# sensor.I2C_DEV = 0x10
# sensor._i2c_query(0x00, '<8B')
for x in range(0, 255):
print(x)
try:
sensor.I2C_DEV = x
print(sensor._i2c_query(0x00, '<8B'))
except Exception as e:
pass # print(e)
Returns:
16
(86, 50, 46, 50, 65, 32, 32, 32)
So then the next logical conclusion:
import nxt.locator
import nxt.sensor.generic
brick = nxt.locator.find()
sensor = brick.get_sensor(nxt.sensor.Port.S1, nxt.sensor.generic.BaseDigitalSensor)
sensor.I2C_DEV = 0x10
sensor._i2c_query(0x00, '<8B')
That returns the same array as above. Wohoo!
So I determined after a lot of testing that there were 2 issues:
- Longer wires do not work for the SuperPro. It has a bunch of signal problems that I eventually was able to isolate by removing the extra cabling I was using. This could have also been the fault of the breadboard connection I was using to interface with the NXT ports and the scope I was using for I2C protocol hacking.
- The I2C address is not
0x02
as it is in the existing code, but0x10
.
>>> print(sensor.get_sensor_info())
Version: `V2.2A `
0x56, 0x32, 0x2e, 0x32, 0x41, 0x20, 0x20, 0x20,
Product ID: `HiTechnc`
0x48, 0x69, 0x54, 0x65, 0x63, 0x68, 0x6e, 0x63,
Type: `SuperPro`
0x53, 0x75, 0x70, 0x65, 0x72, 0x50, 0x72, 0x6f,
from nxt-python.
Thank, this is great findings!
It’s strange that they changed the I2C address, this means that the autodetect can not work with this device.
It looks like SuperPro and Prototype are different boards:
Would you like to make a new sensor class for the SuperPro?
from nxt-python.
Would you like to make a new sensor class for the SuperPro?
Sure. I'd be happy to.
It looks like SuperPro and Prototype are different boards:
Huh. Funny you share that link with that picture because it looks identical to a board that I have that's identified by nothing other than (c) DSI 2007
that I've been trying to determine what/how it works.. It even has the same pinout. I'll try to make both devices work.
from nxt-python.
I just tested the Prototype
board and it literally works out of the box. Was able to get analog readings and do digital reads/writes.
I'd say that the interface could probably be improved a little from passing the class instance (it feels kinda clunky), but it does work at a minimum.
I did find some .. odd? behavior with the digital mode setting; it could be an issue with the device itself but it seems like digital reads or writes is an all or nothing thing for the whole digital bus. I'm not certain if it's the Python doing that or if it's the device firmware running on the chip on the Prototype board itself. More testing to be done there.
from nxt-python.
See #188
from nxt-python.
Nice to resurrect some old hardware :)
I'd say that the interface could probably be improved a little from passing the class instance (it feels kinda clunky), but it does work at a minimum.
Could you clarify this?
I did find some .. odd? behavior with the digital mode setting; it could be an issue with the device itself but it seems like digital reads or writes is an all or nothing thing for the whole digital bus. I'm not certain if it's the Python doing that or if it's the device firmware running on the chip on the Prototype board itself. More testing to be done there.
I would say it is done in the board firmware, it’s a classic way to handle it. If you want to only change a port, you need a Read-Modify-Write cycle.
from nxt-python.
I'd say that the interface could probably be improved a little from passing the class instance (it feels kinda clunky), but it does work at a minimum.
Could you clarify this?
Mostly, I find it odd that this project instantiates sensors by going brick.get_sensor(<sensor port>, <optional sensor class>)
instead of SensorClass(brick, port)
, but I see how you're using that for automatic sensor detection (for some sensors).
I would say it is done in the board firmware, it’s a classic way to handle it. If you want to only change a port, you need a Read-Modify-Write cycle.
The reason it's frustrating is because if you do it that way, that means that you have to set the state of the pin (meaning it's always going to be a bi-state input rather than a tri-state input). I suppose that the device we're using in this case might not support that, but I wanted to test to see if you lost access to a tri-state input by setting the device to output and configuring an output signal.
from nxt-python.
Related Issues (20)
- Assistance required during installation process HOT 26
- Problems with installing nxt-python HOT 4
- Error when connecting with bluetooth HOT 24
- raise BlockedException("Blocked!") HOT 1
- Error struct.error: unpack requires a buffer of 2 bytes (EV3) HOT 4
- No backend available HOT 1
- Help with motorconotrl HOT 1
- Not able to download MotorControl22.nxc to NXT HOT 2
- nxt_filer needs to be updated (minor fixes) HOT 3
- usb.core.USBError: [Errno None] b'libusb0-dll:err [set_configuration] could not set config 1 HOT 7
- Add contribution guide HOT 2
- How save in the lego HOT 1
- Nxt_test hangs at connecting using bluetooth HOT 1
- MotCont: Differential drive robot HOT 4
- Bluetooth Error HOT 12
- EV3 doesn´t connect to NXT (via USB) HOT 5
- simulate NXT brick button presses with nxt-python HOT 4
- [FEATURE REQUEST]: Screen Drawing HOT 1
- [NOOB QUESTION]: How to get rotation angle of motor? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nxt-python.