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.
Dependencies: mbed 4DGL-uLCD-SE mbed-rtos nRF24L01P
Speaker.cpp
00001 #include "Speaker.h" 00002 #define UINT8_MAX 255 00003 00004 Speaker::Speaker(PinName pin) : _pin(pin), dc(0.67f / 3.3f) {} 00005 00006 void Speaker::rawWrite(float value) { 00007 _pin = value; 00008 } 00009 00010 void Speaker::write (uint8_t value) { 00011 float sample = (float)value / UINT8_MAX; 00012 00013 _pin = sample; 00014 } 00015 00016 void Speaker::turnOff() { 00017 _pin = 0.0f; 00018 }
Generated on Tue Jul 12 2022 11:14:19 by
1.7.2