This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Some LM Ambient questions
#7
(11.04.2017, 07:51)admin Wrote: 2. Try this:
Code:
function beep(freq, time)
  local path = '/sys/class/pwm/pwmchip0/pwm1/'
  io.writefile(path .. 'enable', 1)
 
  local period = math.floor(10 ^ 9 / freq)   
  local cycle = math.floor(period / 2)

  io.writefile(path .. 'period', period)
  io.writefile(path .. 'duty_cycle', cycle)

  os.sleep(time)

  io.writefile(path .. 'enable', 0)
end

-- 700hz for 1/10 second
beep(700, 0.1)

Is this code still working? because my ambient doesn't beep
And is it also possible to control the buzzer volume from this script?
Reply


Messages In This Thread
Some LM Ambient questions - by leonidas - 11.04.2017, 07:09
RE: Some LM Ambient questions - by admin - 11.04.2017, 07:51
RE: Some LM Ambient questions - by gjniewenhuijse - 17.05.2021, 14:46
RE: Some LM Ambient questions - by leonidas - 11.04.2017, 08:32
RE: Some LM Ambient questions - by admin - 11.04.2017, 11:41
RE: Some LM Ambient questions - by leonidas - 12.04.2017, 07:59
RE: Some LM Ambient questions - by admin - 12.04.2017, 09:49

Forum Jump: