Code Monkey home page Code Monkey logo

Comments (3)

karan259 avatar karan259 commented on August 24, 2024

The analog or digital read are multistep process. Do you think that making a python script executable and having it return just the value back to the shell would work.

from grovepi.

in8finity avatar in8finity commented on August 24, 2024

I understand but in my case python is excessive dependency. Probably I should try to compile C versions. It will be lighter and faster.
I'm I right that it will be process like described below?

  1. i2cset -y 1 0x04 0x03 0x01 0x00 i; //analogRead to Groove
  2. i2cset -y 1 0x04 0x05 0x01 0x00 i; //set pin into input mode
    ...?
  3. i2cget -y 1 0x04; // but it's getting zero

i2cdump returns data containing the right answer (and then Groove hangs up)

from grovepi.

mcauser avatar mcauser commented on August 24, 2024

In your step 3) you need to read block data, not just a single byte.

# set pin mode to input on port A0
# send block [5 0 0 0]
i2cset -y 1 0x04 1 5 0 0 0 i

# perform an analog read on port A0
# send block [3 0 0 0]
i2cset -y 1 0x04 1 3 0 0 0 i

# 100 millisecond pause
# give the grovepi some time to process the command
sleep .1

# read a byte
i2cget -y 1 0x04 0

# read i2c block data
i2cget -y 1 0x04 0 4

from grovepi.

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.