-
Notifications
You must be signed in to change notification settings - Fork 2
/
SigGen.h
49 lines (44 loc) · 1.07 KB
/
SigGen.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* SigGen.h - Signal Waveform Generator Library
*
* Author: Márcio Pessoa <[email protected]>
* Contributors: none
*
* Waveform example with duration 1000 milliseconds:
*
* 1 ┐ ┌────┐
* │ │ │
* └────┘ └
* 0 500 1000
*
* Change log
* 2015-07-03
* * square
* Added method square to generate square waveform.
* * step
* Added this private method to provide common base time to signals.
*
* 2015-07-03
* * sine
* Added method sine to generate sine waveform.
*
* 2015-06-13
* Experimental version.
*/
#ifndef SigGen_h
#define SigGen_h
#include "Arduino.h"
// If PI constant is not defined, plese uncoment the follow line:
// const float PI = 3.1415926535897932384626433832795028841971693993751058209749445923078164062;
class SigGen
{
public:
SigGen();
float sine();
float square();
void period(unsigned int period);
private:
float step();
unsigned int _millis_period;
unsigned long _millis_elapsed;
};
#endif