Giter Club home page Giter Club logo

Comments (7)

thrazu avatar thrazu commented on June 15, 2024 1

Thanks for your advice. I will adapt the formula to work with the photocell.

from mcp-spi-adc.

fivdi avatar fivdi commented on June 15, 2024 1

The README was updated mentioning that SPI must be enabled to use mcp-spi-adc. See 33ed477.

from mcp-spi-adc.

fivdi avatar fivdi commented on June 15, 2024

It looks like SPI hasn't been enabled. If a Raspberry Pi is being used, which appears to be the case, then SPI can be enabled with the raspi-config tool which can be called from the command line with the following command:

sudo raspi-config

Navigate to "5 Interfacing Options >> P4 SPI" and answer the question "Would you like the SPI interface to be enabled?" with "Yes", then answer "Ok", then answer "Finish".

If a fairly recent version Raspbian is being used a reboot should not be necessary. On an older version of Raspbian a reboot will be necessary.

After SPI has been enabled it should work.

This should be mentioned in the README.

from mcp-spi-adc.

thrazu avatar thrazu commented on June 15, 2024

Thanks for your straight answer!
I have enabled SPI through

sudo raspi-config

command and everything works great now.

from mcp-spi-adc.

fivdi avatar fivdi commented on June 15, 2024

That's good news 😄

I'll leave this issue open as a reminder that a note should be added to the README saying that SPI needs to be enabled before it can work.

One additional point, your program contains the following line of code:

console.log((reading.value * 3.3 - 0.5) * 100);

The formula (reading.value * 3.3 - 0.5) * 100 is for a TMP36 temperature sensor so it will need to be changed for a photocell.

from mcp-spi-adc.

amcelroy avatar amcelroy commented on June 15, 2024

Sorry to re-open this, but I am using an MCP3004 and am getting this when trying to read channels 0, 1, and 2. When reading channel 0 and 1, there are no issues, but reading all 3 produces this error.

from mcp-spi-adc.

fivdi avatar fivdi commented on June 15, 2024

@amcelroy I can't reproduce the error. Please open a new issue containing the following information:

  • A description of the problem
  • The complete stack trace for the EPERM error
  • Minimal but complete sample code that can be used to reproduce the error

from mcp-spi-adc.

Related Issues (16)

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.