I would be happy if you give me a advice or show me the sample code.
One year before, I wrote a luminosity sensor application on my RPi model B in Ruby. Thanks to the this library I could make app without deep understanding.
I've got a RPi2 last week and I've tried to update my luminosity application. Unfortunately, pi_piper doesn't support RPi2. I'm thinking about using the WiringPi-Ruby instead of pi_piper but I don't have any idea where to start.
Here is the code and circuit that I made before.
require 'pi_piper' loop do value = 0 PiPiper::Spi.begin do |spi| raw = spi.write [0b01101000,0] value = ((raw<<8) + raw) & 0x03FF end puts value sleep(1) end
I used the mcp3002 as a ADC.