2014-05-28 05:56:44 -07:00
|
|
|
/*
|
|
|
|
* Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
|
|
|
|
* Copyright (c) 2014 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.
|
2014-05-28 05:56:44 -07:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2014-05-28 05:56:44 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
2017-08-30 15:00:29 -07:00
|
|
|
|
2016-04-25 14:27:51 -07:00
|
|
|
#include "buzzer.hpp"
|
2017-08-30 15:00:29 -07:00
|
|
|
#include "buzzer_tones.h"
|
2017-04-06 16:18:53 -07:00
|
|
|
#include "upm_utilities.h"
|
2014-05-28 05:56:44 -07:00
|
|
|
|
|
|
|
int
|
2017-08-30 15:00:29 -07:00
|
|
|
main(int argc, char** argv)
|
|
|
|
{
|
2015-01-20 14:34:50 -08:00
|
|
|
//! [Interesting]
|
2017-08-30 15:00:29 -07:00
|
|
|
int chord[] = { BUZZER_DO, BUZZER_RE, BUZZER_MI, BUZZER_FA, BUZZER_SOL, BUZZER_LA, BUZZER_SI };
|
2014-06-10 06:54:45 +00:00
|
|
|
|
2014-06-03 09:12:47 +00:00
|
|
|
// create Buzzer instance
|
2018-03-29 18:03:59 +03:00
|
|
|
upm::Buzzer sound(32);
|
2014-06-03 09:12:47 +00:00
|
|
|
// print sensor name
|
2017-08-30 15:00:29 -07:00
|
|
|
std::cout << sound.name() << std::endl;
|
2014-05-28 05:56:44 -07:00
|
|
|
|
2016-10-28 16:47:01 -06:00
|
|
|
// play each sound (DO, RE, MI, etc...) for .5 seconds, pausing
|
|
|
|
// for 0.1 seconds between notes
|
2017-08-30 15:00:29 -07:00
|
|
|
for (int chord_ind = 0; chord_ind < 7; chord_ind++) {
|
|
|
|
std::cout << sound.playSound(chord[chord_ind], 500000) << std::endl;
|
2016-10-28 16:47:01 -06:00
|
|
|
upm_delay_ms(100);
|
2014-06-03 09:12:47 +00:00
|
|
|
}
|
2014-06-10 06:54:45 +00:00
|
|
|
//! [Interesting]
|
2014-05-28 05:56:44 -07:00
|
|
|
|
2014-06-03 09:12:47 +00:00
|
|
|
std::cout << "exiting application" << std::endl;
|
2014-05-28 05:56:44 -07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|