Code Monkey home page Code Monkey logo

Comments (8)

fivdi avatar fivdi commented on May 18, 2024 1

@christianmackin was the content of conversation.js modified to require rpi-gpio as that's the module that the error message is complaining about. If so, package.json will also need to be modified to include rpi-gpio as a dependency.

from tjbot.

victordibia avatar victordibia commented on May 18, 2024

Hi @christianmackin,

Usually, running npm install in the conversation or sit directory should install all the modules needed (including rip-gpio). Can you confirm that you are able to successfully run npm install in the conversation directory? I'd suggest you delete your current node_modules directory (removes the previous installation) and run npm install again. If there are any errors with this .. please post below and we can continue troubleshooting from that point.

-V.

from tjbot.

christianmackin avatar christianmackin commented on May 18, 2024

You are awesome for replying so fast. Thank you.

I used the command 'rm -rf node_modules' and then 'npm install' from the conversation dir. Then sudo node conversation.js and received the same ERROR: Cannot find module 'rpi-gpio'

I looked in 'node_modules' and do not see a dir for 'rpi-gpio.' I don't know if that is an issue.

Previously after seeing the error, I followed the instructions to install rpi-gpio at https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-gpio

from tjbot.

christianmackin avatar christianmackin commented on May 18, 2024

I'm willing to reformat my RPi and start over if you think that is best. If so, can you provide the best workflow that starts from a brand new RPi 3 loaded from NOOBS? I have tried several of the Instructables and curls, but they all end in this problem. I must be doing something wrong in the workflow.

from tjbot.

victordibia avatar victordibia commented on May 18, 2024

Hi,
I'd recommend the manual setup here https://github.com/ibmtjbot/tjbot/tree/master/bootstrap.
Also, I'd recommend that you do not install modules globally "npm install -g".
One more thing ... on inspection we use the pigpio library in tjbotlib and not rpi-gpio. Any chance you can post your conversation file directory (e.g a repo?)

from tjbot.

christianmackin avatar christianmackin commented on May 18, 2024

I'm very embarrassed to say that this is all my fault. I modified the conversation.js file so that I could control the RPi GPIO by voice command in accordance with the following instruction

https://www.instructables.com/id/Turn-on-an-LED-With-Watson-Conversation/
http://www.zagrosrobotics.com/files/LED_Test2.js

I should have thought that could be an issue. After issuing the command 'npm install rpi-gpio' everything works fine now. It just needed that module installed in the home dir.

Notwithstanding the above, do you see a better way that I could control the RPi GPIO from within the original conversation.js and that would more fully interact with Watson? I think I am by passing much of the Watson functionality by coding everything into conversation.js. In other words, how can I use Intents, Entities, and Dialogs to control the GPIO as well as be able to send text strings back from Watson.

I would be happy to post a repo, but I don't know how.

from tjbot.

victordibia avatar victordibia commented on May 18, 2024

Hi,
Glad to know you have made progress with this!
To control gpio pins using watson conversation, you can extend the code in the conversation api.
To learn more about the tjbot library which is used in our conversation sample, please see the project description here - https://github.com/ibmtjbot/tjbotlib .

In the tjbot method used to handle conversation (tj.converse), it returns a response object from the ibm conversation service which you can then query to extract more information (e.g what intent was matched in the conversation tree etc) and then use this information to control GPIO .

A quick example


  tj.converse(WORKSPACEID, turn, function(response) {
           //print out the response object
           console.log(response.object)
            
            // speak the result
            if (response.object.intents[0].intent == "lights"){
                  // do something to gpio .. control lights
            }
});

In the sample above, your conversation workspace should be designed to have an intent called lights which you can check for in order to control GPIO.

-V

from tjbot.

christianmackin avatar christianmackin commented on May 18, 2024

I have spent a few hours looking through the Library and trying some of the syntax shown there. I am only 50% successful in getting new syntax to work within conversation.js and I definitely don't follow your example. Do you have enough free time that you would be open to Freelancing? You can contact me directly through our website https://kohlex.com

from tjbot.

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.