Re: playTone duration in Arduino package

Cathy Zupke <[email protected]>
Newsgroups gmane.comp.gnu.octave.general
Message-ID <CAHSEGpe4Be3PuN4BYz+BXAwCAcFWBgQ1TGrGGX9T0HLKdh4f1w@mail.gmail.com>
Here is an annotated interactive session that I hope answers John's
questions (Octave version is 5.2.0, on Windows 10, arduino version looks
like 0.6.0):

>> pkg load arduino
>> a=arduino()
a =
  arduino object with fields of:
    port = \\.\COM4
    board = uno
    libraries = {
      i2c
      spi
      servo
      shiftregister
    }
    availablepins = {
      d0 - d13
      a0 - a5
    }
>> playTone(a,'D10',440,1) %piezo speaker is attached to D10 and makes a
tone that never stops
>> playTone(a,'D10',300,1) %frequency changes but never stops
>> playTone(a,'D10',0,1) %sound stops
>> playTone(a,'D10',180,3) %makes a tone that never stops
>> playTone(a,'D10',440,0) %frequency changes but never stops
>> version   %I think this gives the version of octave
ans = 5.2.0

>> pkg list  %It looks like arduino package version is 0.6.0
Package Name         | Version | Installation directory
---------------------+---------+-----------------------
            arduino *|   0.6.0 |
...\OCTAVE~1.0\mingw64\share\octave\packages\arduino-0.6.0
              audio  |   2.0.0 |
C:\Octave\OCTAVE~1.0\mingw64\share\octave\packages\audio-2.0.0
     communications  |   1.2.2 |
...\mingw64\share\octave\packages\communications-1.2.2


It is my understanding that the last parameter is supposed to be duration
in seconds. So I'd expect the tones to stop after that time has elapsed.

Thanks.

-Cathy


On Wed, Mar 10, 2021 at 7:06 AM JohnD <[email protected]> wrote:

>
> > Message: 2
> > Date: Mon, 1 Mar 2021 22:04:22 -0600 (CST)
> > From: Ekpuz <[email protected]>
> > To: [email protected]
> > Subject: playTone duration in Arduino package
> > Message-ID: <[email protected]>
> > Content-Type: text/plain; charset=us-ascii
> >
> > I'm trying to use the Arduino package to control an Arduino Uno
> compatible
> > board.  When I use playTone, it will play a tone of the specified
> frequency,
> > but the duration parameter seems to do nothing.  I'm wondering if this
> is a
> > bug or if there is something I may not be doing correctly.
> >
> > -Cathy
> >
>
> What version of octave, what version of the Arduino package, and can you
> give a simple example of what you are doing ?
>
>
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.