2015-09-08 21:58:36 +03:00
|
|
|
/*
|
|
|
|
|
* Author: Andrei Vasiliu <andrei.vasiliu@intel.com>
|
|
|
|
|
* Copyright (c) 2015 Intel Corporation.
|
|
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* This program and the accompanying materials are made available under the
|
|
|
|
|
* terms of the The MIT License which is available at
|
|
|
|
|
* https://opensource.org/licenses/MIT.
|
2015-09-08 21:58:36 +03:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2015-09-08 21:58:36 +03:00
|
|
|
*/
|
|
|
|
|
|
2018-02-27 12:12:09 -08:00
|
|
|
public class Speaker_Example {
|
2015-09-08 21:58:36 +03:00
|
|
|
|
|
|
|
|
public static void main(String[] args) throws InterruptedException {
|
2015-10-08 14:30:12 +03:00
|
|
|
// ! [Interesting]
|
2016-09-13 16:09:09 -07:00
|
|
|
// Instantiate a Speaker on digital pin D2
|
|
|
|
|
upm_speaker.Speaker speaker = new upm_speaker.Speaker(2);
|
2015-10-08 14:30:12 +03:00
|
|
|
|
2015-09-08 21:58:36 +03:00
|
|
|
// Play all 7 of the lowest notes
|
2015-08-12 16:44:30 +03:00
|
|
|
speaker.playAll();
|
2015-10-08 14:30:12 +03:00
|
|
|
|
2015-09-08 21:58:36 +03:00
|
|
|
// Play a medium C-sharp
|
|
|
|
|
speaker.playSound('c', true, "med");
|
2015-10-08 14:30:12 +03:00
|
|
|
// ! [Interesting]
|
|
|
|
|
}
|
2015-09-08 21:58:36 +03:00
|
|
|
|
2016-09-13 16:09:09 -07:00
|
|
|
}
|