Code Monkey home page Code Monkey logo

Comments (4)

schodet avatar schodet commented on September 5, 2024

Hello,

You can access internal firmware using io maps, there is an io map for button here:

https://git.ni.fr.eu.org/nxt-firmware.git/tree/src/c_button.iom

You can try to make sense of the corresponding module to see whether it would be possible to simulate a button press:

https://git.ni.fr.eu.org/nxt-firmware.git/tree/src/c_button.c

Here is the function used to read the button state for the menus:

https://git.ni.fr.eu.org/nxt-firmware.git/tree/src/c_ui.c#n389

So setting PRESSED_STATE in the corresponding State array should work.

Have fun!

Nicolas.

from nxt-python.

schodet avatar schodet commented on September 5, 2024

Tell me if you need help to make a prototype.

from nxt-python.

arohrbacher avatar arohrbacher commented on September 5, 2024

Hi Nicolas,
many thanks for your pointers! Very helpful, I got it to work!

First I had to figure out the module id for the buttons:
modules = b.find_modules()
for x in modules:
print(x)
resulting in (amongs others): ('Button.mod', 262145, 0, 36)
I was then continuously reading the iomap data with
data = b.read_io_map(0x40001, 0, 36)[1]
for y in range(0,len(data)):
print(data[y], end = ' ')
print()
and observing what happens when I press the buttons on the NXT brick. After I knew this, I could issue this group of commands
b.write_io_map(0x40001, 34, bytearray([0x80]))
b.write_io_map(0x40001, 34, bytearray([0x80]))
b.write_io_map(0x40001, 34, bytearray([0x0]))
b.write_io_map(0x40001, 34, bytearray([0x0]))
which "simulates" a press of the left-button (complete with "!Click"-sound). The right-button would have offset 33, return-button offset 32, and exit-button offset 35.
For some reason I have to issue the write_io_map commands twice - otherwise my NXT brick would occasionally "miss" a simulated keystroke...
Anyway, now I just have to extend nxt-screen.py to include a button-interface to get a completely remote-controlled NXT brick.

Best regards,

Andreas

from nxt-python.

schodet avatar schodet commented on September 5, 2024

Nice, waiting for your pull request :)

from nxt-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.