-2

I would like to use the Arduino sensor in raspberry pi.

Since the sample file for the sensor is dedicated to the Arduino, the example header file is also dedicated to Arduino.

The example code uses the spi.h file. Can I download the header file and use it in Raspberry Pi?

1 Answers1

3

That wouldn't make sense for various reasons and it wouldn't work for various reasons.

SPI is a serial interface. You don't need Arudino code to communicate via SPI on Raspberry PI. There are many examples on how to do that on Raspberry PI.

The sensor doesn't need an arduino. All it needs is power and someone to talk to.

The fact that you ask this question shows that you should invest time into learning C/C++ and get some basic knowledge about microcontrollers and serial interfaces.

If you're lost in an unknown jungle it won't help you to bring a map from another unknown jungle... So what do you have to do? Learn about jungles in general and some day you'll be able to survive in most of them.

Piglet
  • 27,501
  • 3
  • 20
  • 43
  • um.... However, this example code uses the spi.h file that exists in the adino. I opened that header file and spi.h is using the arduino.h header file, so I do not know how to use this example in Raspberry Pie. – 김유정 Jul 25 '17 at 16:59
  • 2
    @김유정 just don't. ;) it's an example for Arduino. You have a Raspberry Pi. Use an SPI example for Rapsberry PI. just the first thing I found on google: http://www.raspberry-projects.com/pi/programming-in-c/spi/using-the-spi-interface – Piglet Jul 25 '17 at 17:44