Sha256: 1536206bd6e5cc1902d2acaa6b93cf4ecf2c5bedbdd5035621e58a90e5bd516a
Contents?: true
Size: 745 Bytes
Versions: 7
Compression:
Stored size: 745 Bytes
Contents
#frozen_string_literal: true module FFI::WiringPi::SoftTone extend FFI::Library ffi_lib 'wiringPi' attach_function :soft_tone_create, :softToneCreate, [:int], :int attach_function :soft_tone_write, :softToneWrite , [:int, :int], :void class Pin def initialize(pin) @pin = pin status = FFI::WiringPi::SoftTone.soft_tone_create pin raise "Something went wrong: Errno:#{FFI::LastError.error}" unless status == 0 end # Sets the frequency of software PWM in tone mode (50%) # @param frequecy [Integer] if 0 - disable output, if less than 5000 usually # produces sound (if connected to devise) def write(frequecy) FFI::WiringPi::SoftTone.soft_tone_write @pin, frequecy end end end
Version data entries
7 entries across 7 versions & 1 rubygems