@@ -72,6 +72,8 @@ have become slightly slower.
72
72
| Arduino UNO | 16 MHz | square | 57 | 1000 Hz |
73
73
| Arduino UNO | 16 MHz | random_DC | 68 | 500 Hz |
74
74
75
+ See ** functionGeneratorPerformance.ino**
76
+
75
77
76
78
#### Accuracy
77
79
@@ -130,10 +132,6 @@ The variable t == time in seconds.
130
132
- ** float triangle(float t)** triangle form, duty cycle default 50%.
131
133
- ** float square(float t)** square wave with duty cycle default 50%.
132
134
- ** float sinus(float t)** sinus wave, has no duty cycle.
133
- - ** float sinusDiode(float t)** sinus wave, only positive pulses.
134
- (Better name welcome).
135
- - ** float sinusRectified(float t)** sinus wave, with "abs(negative pulses)".
136
- (Better name welcome).
137
135
- ** float stair(float t, uint16_t steps = 8, uint8_t mode = 0)** defaults to 8 steps up.
138
136
- mode = 0 ==> steps up
139
137
- mode = 1 ==> steps down. Effectively equals inverting the amplitude.
@@ -146,6 +144,17 @@ The functions **line()** and **zero()** can be used to drive a constant voltage
146
144
from a DAC and can be used to calibrate the generator / DAC combination.
147
145
148
146
147
+ Experimental 0.2.7
148
+
149
+ - ** float sinusDiode(float t)** sinus wave, only positive pulses.
150
+ (better name welcome).
151
+ - ** float sinusRectified(float t)** sinus wave, with "abs(negative pulses)".
152
+ (better name welcome).
153
+ - ** float trapezium1(float t)** trapezium wave, DutyCycle changes steepness falling rising.
154
+ - ** float trapezium2(float t)** trapezium wave, DutyCycle changes period HIGH vs LOW
155
+
156
+ Note at 50% DC the two trapezium functions are identical.
157
+
149
158
#### Duty Cycle
150
159
151
160
Since 0.2.5 the library has ** experimental** support for duty cycle.
@@ -164,7 +173,14 @@ with respect to previous value.
164
173
Implemented as a weighed average between new and previous value.
165
174
Made a separate function as handling the duty cycle slows performance substantial.
166
175
Initial starts at zero and can be adjusted with ** YShift()** .
176
+ - ** float trapezium1(float t)** The duty cycle determines the steepness of the rising
177
+ and falling edges. This changes the form from square wave to trapezium to triangle.
178
+ The length of the HIGH LOW level go from 0 to half a period.
179
+ - ** float trapezium2(float t)** The duty cycle determines the length of the HIGH level,
180
+ which is 0 for 0% DC and half a period for 100% DC.
181
+ The rising and falling edges stay same.
167
182
183
+ #### No duty cycle
168
184
169
185
The other functions need to be investigated what duty cycle means.
170
186
Current ideas that are ** NOT** implemented:
@@ -175,32 +191,33 @@ Think of it as the halve of the triangle wave.
175
191
- ** stair()** like sawtooth??
176
192
- ** line()** has no period so does not make sense (yet).
177
193
- ** zero()** has no period so does not make sense (yet).
194
+ - ** float sinusDiode(float t)**
195
+ - ** float sinusRectified(float t)**
196
+
178
197
179
198
Feedback and ideas are welcome.
180
199
181
200
182
201
## Future
183
202
184
-
185
203
#### Must
186
204
187
205
- documentation
188
206
- quality of signals - after substantial time t
189
207
- max freq per wave form etc.
190
208
Should this be in the library?
191
209
192
-
193
210
#### Should
194
211
195
212
- smart reseed needed for random().
196
213
- initialize random generator with compile time.
197
214
198
-
199
215
#### Could
200
216
201
217
- waves
202
- - trapezium wave (could merge square and triangle and sawtooth)
203
218
- white noise, pink noise etc.
219
+ - heart beat (quite complex but fun)
220
+ - multiMap interpolation point curves.
204
221
- RC function curve.
205
222
- external clock to synchronize two or more software function generators.
206
223
- stand-alone functions in separate .h
@@ -211,7 +228,6 @@ Feedback and ideas are welcome.
211
228
- add float variable for ``` _perDC = _period * _dutyCycle ```
212
229
- do we need ** freq4** ? not since DC.
213
230
214
-
215
231
#### Examples
216
232
217
233
- Amplitude modulation ?
0 commit comments