Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: PN532_ReadUid Nfctest2
Arduino.cpp
- Committer:
- dotnfc
- Date:
- 2016-09-13
- Revision:
- 1:b5922b3b3257
- Parent:
- 0:db8030e71f55
File content as of revision 1:b5922b3b3257:
////////////////////////////////////////////////////////////////////////////////
// arudino wraper functions
// by dotnfc@163.com
// 2016/09/10 18:16:00
#include "Arduino.h"
/*==============================================================================
* \brief arduino like 'tone ()'
*/
void tone(PwmOut &buz, long frequency)
{
if (frequency == 0) {
buz = 0;
return;
}
float period;
// calculate the period of the note in turn play
period = 1000000 / frequency;
// set the period calculated at the PWM output
buz.period_us (period);
// establish a duty cycle of 50%
buz.write (0.50f);
}