Non-blocking “breathing” led

Hello Friends!
I am using this code with this formula for non blocking led:

float val = ( exp ( sin (i/2000.0PI10)) - 0.36787944)*108.0;

the val value is going from 0 to 255 and back, works everything well.. but in my case I need to change to - from 20 to 255 and back. Any idea how can I change this formula? For now I made it like this:
if(val < 20) val = 20;
but I can clearly see this freezing and it looks not so nice.
Thanks!

Suggest you just generate a 20-255 PWM wave form using a non-blocking TIMER.

BTW, never drive a common LED without using a series current limiting resistor !

1 Like

The values must start at 20 and still only go up to 255.

So this means the values start at 20 which is done by a +20
and to not exceed 255 the values shall only go up to 255 -20 = 235
So this means you have to tweak the amplitude of the sinus-function

I haven't done something like this before.
My first try would be to reduce the 108.0 to a smaller value

I would do the tweaking by printing the value of variable "val" to the serial monitor

best regards Stefan

I have tried to change all values 108, 10, 2000, but it affects only the speed, but not the endpoints.



#define ledPin                 11

byte index                   = 20;
int incDec                   = 1;

unsigned long breathe_delay  = 4;   
unsigned long breathe_time   = 0;


//********************************************^************************************************
void setup()
{
  Serial.begin(115200);

  pinMode(ledPin, OUTPUT);

} //END of   setup()


//********************************************^************************************************
void loop()
{
  //**********************************
  //is it time to change LED brightness ?
  if (millis() - breathe_time >= breathe_delay)
  {
    //restart this TIMER
    breathe_time = millis();

    analogWrite(ledPin, index);

    index = index + incDec;

    if (index == 255)
    {
      incDec = -1;
    }

    else if (index == 20)
    {
      incDec = 1;
    }
  }

  //**********************************
  //other non-blocking code goes here
  //**********************************

} //END of   loop()


Thank you Larry for your code. The problem is it uses proportional to time brightness value. The code I have posted use S curve brightness value. It looks more natural.

Correct.

At the expense of using the math library. :thinking:

If you are trying to plot a sine wave, using floats and sine() will make it g;acier slow compared to tabling int values of sine * 10000 and fetching those values to scale with. So sine of 30 gives 5000 to use in calcs and divide by 10000 if you don't want the extra places but can take smaller units ( I could say 3.333V or I could say 3333mV and totally avoid the decimal point and dirt-in-sand IEEE floating-point :smiley: ).

Integers (like type long) lose places in round-off-division (get the remainder with the % operation if you want) so I go big to get extra places to lose, for meters to 3 places I may use micrometers (6 places) and lose 3 at the end and the label says "mm" or I crank out and print meters then print a dec pt then print the /1000 remainder but only the high 3 places and always be correct.

You should have room in flash for a big table, 1 quadrant worth can give sine and cosine (read in reverse order) in like 6 cycles, less than 1/2 a microsecond or spend 100's of cycles on a single float operation.

This method of looking up pre-calculated values is how 6502 computers were able to run any kind of flight sims at all!

2 Likes

To change the formula so that the val value goes from -20 to 255 and back, you can modify the formula as follows:

float val = (exp(sin(i/2000.0*PI*10)) - 0.36787944) * 127.5; // Adjust the scaling factor
val = val - 20; // Shift the range by -20
if (val < 0) val = 0; // Ensure the minimum value is 0

This modification scales the range from 0-255 to -20-255 and ensures that the value doesn't go below 0. This should give you the effect you need without freezing and with a smoother transition.

Does not work. Intuitively @StefanL38 notices that the range is 0 - 255, and that to make it occupy a smaller range would have to involve decreasing the 108.0 constant.

Did you run the code that you wrote? I did, it does not work, as we suspected.

This comes closer

    val = (exp(sin(i/2000.0*PI*10)) - 0.36787944) * 99; // Adjust the scaling factor
    val = val + 20; // Shift the range by 20
    if (val < 20.0) val = 20.0; // Ensure the minimum value is 20.0

a7

In my understanding this is not what user @mastino2 wants

The lowest value shall be 20 and going up from there to 255

I coded a second function that does iterate a few periods
what is inside the sine-function determines frequency
this is

sin( i / 2000.0 * PI * 10) 

so if you keep i / 2000.0 * PI * 10 the same the frequency stays the same

I defined constants for the numbers

#define div2000 2000.0
#define minus0_36 0.55 // 0.36787944
#define mult108 100.0  // 108
#define baseOffset 38  // 0

I did some modifications to

  • 0.36787944) * 108.0;

and finally landed at

float val = (exp ( sin( i / div2000 * PI * 10) ) - minus0_36) * mult108 + baseOffset;

which is

float val = (exp ( sin( i / 2000.0 * PI * 10) ) - 0.55) * 100.0 + 38.0;

The steepness of the S-curve is determined by the -0.55 and the * 100
If you use a table-calculation-software like LibreOffice-Calc
and display the data as a XY-diagramm you will see what parameter does what

So here is the complete code for the tweaking that I used

/*

  NonBlockingBreathingLed 0.1
  by Luca Soltoggio - 2015
  12 May 2015
  http://www.arduinoelettronica.com/
  https://arduinoelectronics.wordpress.com/
  http://minibianpi.wodpress.com/

  Use a exp + sin function to recreate a
  non-blocking breathing led effect

  Released under GPL v.2 license

*/

#include <math.h>
#define ledPin 11

#define div2000 2000.0
#define minus0_36 0.55 // 0.36787944
#define mult108 100.0  // 108
#define baseOffset 38  // 0


/*
#define div2000 2000.0
#define minus0_36 0.36787944
#define mult108 108
#define baseOffset 0
*/

int i = 0;
int breathe_delay = 15;   // delay between loops
unsigned long breathe_time = millis();
void setup() {
  Serial.begin(115200);
  OnenonBlockingBreath();
}


void loop() {
  //nonBlockingBreath();  // call the nonblocking function
  // yourOtherCodeHere();
}

void OnenonBlockingBreath() {

  for (int i = 0; i < 1500; i++) {
    //if ( (breathe_time + breathe_delay) < millis() ) {
      breathe_time = millis();
      //float val = (exp ( sin( i / 2000.0 * PI * 10) ) - 0.36787944) * 108.0;
      float val = (exp ( sin( i / div2000 * PI * 10) ) - minus0_36) * mult108 + baseOffset;
      Serial.print(i);
      Serial.print(" ");
      
      Serial.println(val);
      //(exp (  sin(i / 2000.0 * PI * 10) ) - 0.36787944)    *  108.0;
      // this is the math function recreating the effect
      analogWrite(ledPin, val);  // PWM
      //i = i + 1;
    //}
  }
}


void nonBlockingBreath() {
  if ( (breathe_time + breathe_delay) < millis() ) {
    breathe_time = millis();
    float val = (exp ( sin( i / 2000.0 * PI * 10) ) - 0.36787944) * 108.0;
    Serial.println(val);
    //(exp (  sin(i / 2000.0 * PI * 10) ) - 0.36787944)    *  108.0;
    // this is the math function recreating the effect
    analogWrite(ledPin, val);  // PWM
    i = i + 1;
  }
}

here is the comparising of the modificated and the original values

	modificated		original	
1	84.58		1	69.98
2	86.19		2	71.72
3	87.82		3	73.48
4	89.48		4	75.27
5	91.16		5	77.08
6	92.87		6	78.93
7	94.60		7	80.80
8	96.35		8	82.69
9	98.13		9	84.61
10	99.93		10	86.56
11	101.76		11	88.53
12	103.61		12	90.53
13	105.48		13	92.55
14	107.38		14	94.60
15	109.29		15	96.67
16	111.23		16	98.76
17	113.20		17	100.88
18	115.18		18	103.02
19	117.18		19	105.19
20	119.21		20	107.37
21	121.25		21	109.58
22	123.32		22	111.81
23	125.40		23	114.06
24	127.50		24	116.33
25	129.62		25	118.62
26	131.76		26	120.93
27	133.91		27	123.25
28	136.08		28	125.59
29	138.26		29	127.95
30	140.46		30	130.32
31	142.67		31	132.71
32	144.89		32	135.11
33	147.13		33	137.52
34	149.37		34	139.95
35	151.62		35	142.38
36	153.89		36	144.83
37	156.16		37	147.28
38	158.43		38	149.74
39	160.71		39	152.20
40	163.00		40	154.67
41	165.29		41	157.14
42	167.58		42	159.61
43	169.87		43	162.09
44	172.16		44	164.56
45	174.45		45	167.03
46	176.73		46	169.50
47	179.01		47	171.96
48	181.29		48	174.42
49	183.55		49	176.87
50	185.81		50	179.31
51	188.06		51	181.73
52	190.29		52	184.15
53	192.52		53	186.55
54	194.72		54	188.93
55	196.91		55	191.30
56	199.09		56	193.64
57	201.24		57	195.97
58	203.37		58	198.27
59	205.48		59	200.55
60	207.57		60	202.80
61	209.63		61	205.03
62	211.66		62	207.23
63	213.67		63	209.39
64	215.64		64	211.52
65	217.58		65	213.62
66	219.49		66	215.68
67	221.36		67	217.70
68	223.20		68	219.69
69	225.00		69	221.63
70	226.76		70	223.53
71	228.48		71	225.38
72	230.15		72	227.19
73	231.78		73	228.95
74	233.37		74	230.66
75	234.90		75	232.33
76	236.39		76	233.93
77	237.83		77	235.49
78	239.22		78	236.99
79	240.56		79	238.43
80	241.84		80	239.82
81	243.07		81	241.15
82	244.25		82	242.42
83	245.36		83	243.62
84	246.42		84	244.76
85	247.42		85	245.84
86	248.36		86	246.86
87	249.24		87	247.81
88	250.06		88	248.69
89	250.81		89	249.50
90	251.50		90	250.25
91	252.13		91	250.93
92	252.69		92	251.54
93	253.19		93	252.08
94	253.62		94	252.54
95	253.99		95	252.94
96	254.29		96	253.26
97	254.53		97	253.52
98	254.69		98	253.70
99	254.79		99	253.81
100	254.83		100	253.84
101	254.79		101	253.81
102	254.69		102	253.70
103	254.53		103	253.52
104	254.29		104	253.26
105	253.99		105	252.94
106	253.62		106	252.54
107	253.19		107	252.08
108	252.69		108	251.54
109	252.13		109	250.93
110	251.50		110	250.25
111	250.81		111	249.50
112	250.06		112	248.69
113	249.24		113	247.81
114	248.36		114	246.86
115	247.42		115	245.84
116	246.42		116	244.76
117	245.36		117	243.62
118	244.25		118	242.42
119	243.07		119	241.15
120	241.84		120	239.82
121	240.56		121	238.43
122	239.22		122	236.99
123	237.83		123	235.49
124	236.39		124	233.93
125	234.90		125	232.33
126	233.37		126	230.66
127	231.78		127	228.95
128	230.15		128	227.19
129	228.48		129	225.38
130	226.76		130	223.53
131	225.00		131	221.63
132	223.20		132	219.69
133	221.36		133	217.70
134	219.49		134	215.68
135	217.58		135	213.62
136	215.64		136	211.52
137	213.67		137	209.39
138	211.66		138	207.23
139	209.63		139	205.03
140	207.57		140	202.80
141	205.48		141	200.55
142	203.37		142	198.27
143	201.24		143	195.97
144	199.09		144	193.64
145	196.91		145	191.30
146	194.72		146	188.93
147	192.52		147	186.55
148	190.29		148	184.15
149	188.06		149	181.73
150	185.81		150	179.31
151	183.55		151	176.87
152	181.29		152	174.42
153	179.01		153	171.96
154	176.73		154	169.50
155	174.45		155	167.03
156	172.16		156	164.56
157	169.87		157	162.09
158	167.58		158	159.61
159	165.29		159	157.14
160	163.00		160	154.67
161	160.71		161	152.20
162	158.43		162	149.74
163	156.16		163	147.28
164	153.89		164	144.83
165	151.62		165	142.38
166	149.37		166	139.95
167	147.13		167	137.52
168	144.89		168	135.11
169	142.67		169	132.71
170	140.46		170	130.32
171	138.26		171	127.95
172	136.08		172	125.59
173	133.91		173	123.25
174	131.76		174	120.93
175	129.62		175	118.62
176	127.50		176	116.33
177	125.40		177	114.06
178	123.32		178	111.81
179	121.25		179	109.58
180	119.21		180	107.37
181	117.18		181	105.19
182	115.18		182	103.02
183	113.20		183	100.88
184	111.23		184	98.76
185	109.29		185	96.67
186	107.38		186	94.60
187	105.48		187	92.55
188	103.61		188	90.53
189	101.76		189	88.53
190	99.93		190	86.56
191	98.13		191	84.61
192	96.35		192	82.69
193	94.60		193	80.79
194	92.87		194	78.93
195	91.16		195	77.08
196	89.48		196	75.27
197	87.82		197	73.48
198	86.19		198	71.72
199	84.58		199	69.98
200	83.00		200	68.27
201	81.44		201	66.59
202	79.91		202	64.93
203	78.40		203	63.30
204	76.91		204	61.70
205	75.45		205	60.12
206	74.02		206	58.57
207	72.61		207	57.04
208	71.22		208	55.55
209	69.86		209	54.08
210	68.52		210	52.63
211	67.20		211	51.21
212	65.91		212	49.81
213	64.65		213	48.45
214	63.40		214	47.10
215	62.18		215	45.78
216	60.98		216	44.49
217	59.81		217	43.22
218	58.65		218	41.98
219	57.52		219	40.76
220	56.42		220	39.56
221	55.33		221	38.39
222	54.27		222	37.24
223	53.22		223	36.11
224	52.20		224	35.01
225	51.20		225	33.93
226	50.22		226	32.87
227	49.26		227	31.83
228	48.33		228	30.82
229	47.41		229	29.83
230	46.51		230	28.86
231	45.63		231	27.91
232	44.77		232	26.98
233	43.93		233	26.07
234	43.11		234	25.18
235	42.30		235	24.32
236	41.52		236	23.47
237	40.75		237	22.64
238	40.00		238	21.83
239	39.27		239	21.04
240	38.56		240	20.27
241	37.86		241	19.52
242	37.18		242	18.78
243	36.51		243	18.06
244	35.87		244	17.36
245	35.23		245	16.68
246	34.62		246	16.02
247	34.02		247	15.37
248	33.43		248	14.74
249	32.86		249	14.12
250	32.31		250	13.52
251	31.77		251	12.94
252	31.24		252	12.37
253	30.73		253	11.82
254	30.23		254	11.28
255	29.75		255	10.76
256	29.28		256	10.25
257	28.82		257	9.76
258	28.38		258	9.28
259	27.95		259	8.81
260	27.53		260	8.36
261	27.12		261	7.92
262	26.73		262	7.50
263	26.35		263	7.09
264	25.98		264	6.69
265	25.63		265	6.31
266	25.28		266	5.94
267	24.95		267	5.58
268	24.63		268	5.23
269	24.32		269	4.90
270	24.02		270	4.58
271	23.74		271	4.27
272	23.46		272	3.97
273	23.20		273	3.68
274	22.94		274	3.41
275	22.70		275	3.14
276	22.46		276	2.89
277	22.24		277	2.65
278	22.03		278	2.42
279	21.83		279	2.20
280	21.63		280	1.99
281	21.45		281	1.80
282	21.28		282	1.61
283	21.12		283	1.43
284	20.96		284	1.27
285	20.82		285	1.11
286	20.68		286	0.97
287	20.56		287	0.83
288	20.45		288	0.71
289	20.34		289	0.60
290	20.24		290	0.49
291	20.16		291	0.40
292	20.08		292	0.31
293	20.01		293	0.24
294	19.95		294	0.18
295	19.90		295	0.12
296	19.86		296	0.08
297	19.83		297	0.04
298	19.81		298	0.02
299	19.79		299	0.00
300	19.79		300	0.00
301	19.79		301	0.00
302	19.81		302	0.02
303	19.83		303	0.04
304	19.86		304	0.08
305	19.90		305	0.12
306	19.95		306	0.18
307	20.01		307	0.24
308	20.08		308	0.31
309	20.16		309	0.40
310	20.24		310	0.49
311	20.34		311	0.60
312	20.45		312	0.71
313	20.56		313	0.83
314	20.68		314	0.97
315	20.82		315	1.11
316	20.96		316	1.27
317	21.12		317	1.43
318	21.28		318	1.61
319	21.45		319	1.80
320	21.63		320	1.99
321	21.83		321	2.20
322	22.03		322	2.42
323	22.24		323	2.65
324	22.46		324	2.89
325	22.70		325	3.14
326	22.94		326	3.41
327	23.20		327	3.68
328	23.46		328	3.97
329	23.74		329	4.27
330	24.02		330	4.58
331	24.32		331	4.90
332	24.63		332	5.23
333	24.95		333	5.58
334	25.28		334	5.94
335	25.63		335	6.31
336	25.98		336	6.69
337	26.35		337	7.09
338	26.73		338	7.50
339	27.12		339	7.92
340	27.53		340	8.36
341	27.95		341	8.81
342	28.38		342	9.28
343	28.82		343	9.76
344	29.28		344	10.25
345	29.75		345	10.76
346	30.23		346	11.28
347	30.73		347	11.82
348	31.24		348	12.37
349	31.77		349	12.94
350	32.31		350	13.52
351	32.86		351	14.12
352	33.43		352	14.74
353	34.02		353	15.37
354	34.62		354	16.02
355	35.23		355	16.68
356	35.87		356	17.36
357	36.51		357	18.06
358	37.18		358	18.78
359	37.86		359	19.52
360	38.56		360	20.27
361	39.27		361	21.04
362	40.00		362	21.83
363	40.75		363	22.64
364	41.52		364	23.47
365	42.30		365	24.32
366	43.11		366	25.18
367	43.93		367	26.07
368	44.77		368	26.98
369	45.63		369	27.91
370	46.51		370	28.86
371	47.41		371	29.83
372	48.33		372	30.82
373	49.26		373	31.83
374	50.22		374	32.87
375	51.20		375	33.93
376	52.20		376	35.01
377	53.22		377	36.11
378	54.27		378	37.24
379	55.33		379	38.39
380	56.42		380	39.56
381	57.52		381	40.76
382	58.65		382	41.98
383	59.81		383	43.22
384	60.98		384	44.49
385	62.18		385	45.78
386	63.40		386	47.10
387	64.65		387	48.45
388	65.91		388	49.81
389	67.20		389	51.21
390	68.52		390	52.63
391	69.86		391	54.08
392	71.22		392	55.55
393	72.61		393	57.04
394	74.02		394	58.57
395	75.45		395	60.12
396	76.91		396	61.70
397	78.40		397	63.30
398	79.91		398	64.93
399	81.44		399	66.59
400	83.00		400	68.27
401	84.58		401	69.98
402	86.19		402	71.72
403	87.82		403	73.48
404	89.48		404	75.27
405	91.16		405	77.08
406	92.87		406	78.93
407	94.60		407	80.80
408	96.35		408	82.69
409	98.13		409	84.61
410	99.93		410	86.56
411	101.76		411	88.53
412	103.61		412	90.53
413	105.48		413	92.55
414	107.38		414	94.60
415	109.29		415	96.67
416	111.23		416	98.76
417	113.20		417	100.88
418	115.18		418	103.02
419	117.18		419	105.19
420	119.21		420	107.37
421	121.25		421	109.58
422	123.32		422	111.81
423	125.40		423	114.06
424	127.50		424	116.33
425	129.62		425	118.62
426	131.76		426	120.93
427	133.91		427	123.25
428	136.08		428	125.59
429	138.26		429	127.95
430	140.46		430	130.32
431	142.67		431	132.71
432	144.89		432	135.11
433	147.13		433	137.52
434	149.37		434	139.95
435	151.62		435	142.38
436	153.89		436	144.83
437	156.16		437	147.28
438	158.43		438	149.74
439	160.71		439	152.20
440	163.00		440	154.67
441	165.29		441	157.14
442	167.58		442	159.61
443	169.87		443	162.09
444	172.16		444	164.56
445	174.45		445	167.03
446	176.73		446	169.50
447	179.01		447	171.96
448	181.29		448	174.42
449	183.55		449	176.87
450	185.81		450	179.31
451	188.06		451	181.73
452	190.29		452	184.15
453	192.52		453	186.55
454	194.72		454	188.93
455	196.91		455	191.30
456	199.09		456	193.64
457	201.24		457	195.97
458	203.37		458	198.27
459	205.48		459	200.55
460	207.57		460	202.80
461	209.63		461	205.03
462	211.66		462	207.23
463	213.67		463	209.39
464	215.64		464	211.52
465	217.58		465	213.62
466	219.49		466	215.68
467	221.36		467	217.70
468	223.20		468	219.69
469	225.00		469	221.63
470	226.76		470	223.53
471	228.48		471	225.38
472	230.15		472	227.19
473	231.78		473	228.95
474	233.37		474	230.66
475	234.90		475	232.33
476	236.39		476	233.93
477	237.83		477	235.49
478	239.22		478	236.99
479	240.56		479	238.43
480	241.84		480	239.82
481	243.07		481	241.15
482	244.25		482	242.42
483	245.36		483	243.62
484	246.42		484	244.76
485	247.42		485	245.84
486	248.36		486	246.86
487	249.24		487	247.81
488	250.06		488	248.69
489	250.81		489	249.50
490	251.50		490	250.25
491	252.13		491	250.93
492	252.69		492	251.54
493	253.19		493	252.08
494	253.62		494	252.54
495	253.99		495	252.94
496	254.29		496	253.26
497	254.53		497	253.52
498	254.69		498	253.70
499	254.79		499	253.81
500	254.83		500	253.84
501	254.79		501	253.81
502	254.69		502	253.70
503	254.53		503	253.52
504	254.29		504	253.26
505	253.99		505	252.94
506	253.62		506	252.54
507	253.19		507	252.08
508	252.69		508	251.54
509	252.13		509	250.93
510	251.50		510	250.25
511	250.81		511	249.50
512	250.06		512	248.69
513	249.24		513	247.81
514	248.36		514	246.86
515	247.42		515	245.84
516	246.42		516	244.76
517	245.36		517	243.62
518	244.25		518	242.42
519	243.07		519	241.15
520	241.84		520	239.82
521	240.56		521	238.43
522	239.22		522	236.99
523	237.83		523	235.49
524	236.39		524	233.93
525	234.90		525	232.33
526	233.37		526	230.66
527	231.78		527	228.95
528	230.15		528	227.19
529	228.48		529	225.38
530	226.76		530	223.53
531	225.00		531	221.63
532	223.20		532	219.69
533	221.36		533	217.70
534	219.49		534	215.68
535	217.58		535	213.62
536	215.64		536	211.52
537	213.67		537	209.39
538	211.66		538	207.23
539	209.63		539	205.03
540	207.57		540	202.80
541	205.48		541	200.55
542	203.37		542	198.27
543	201.24		543	195.97
544	199.09		544	193.64
545	196.91		545	191.30
546	194.72		546	188.93
547	192.52		547	186.55
548	190.29		548	184.15
549	188.06		549	181.73
550	185.81		550	179.31
551	183.55		551	176.87
552	181.29		552	174.42
553	179.01		553	171.96
554	176.73		554	169.50
555	174.45		555	167.03
556	172.16		556	164.56
557	169.87		557	162.09
558	167.58		558	159.61
559	165.29		559	157.14
560	163.00		560	154.67
561	160.71		561	152.20
562	158.43		562	149.74
563	156.16		563	147.28
564	153.89		564	144.83
565	151.62		565	142.38
566	149.37		566	139.95
567	147.13		567	137.52
568	144.89		568	135.11
569	142.67		569	132.71
570	140.46		570	130.32
571	138.26		571	127.95
572	136.08		572	125.59
573	133.91		573	123.25
574	131.76		574	120.93
575	129.62		575	118.62
576	127.50		576	116.33
577	125.40		577	114.06
578	123.32		578	111.81
579	121.25		579	109.58
580	119.21		580	107.37
581	117.18		581	105.19
582	115.18		582	103.02
583	113.20		583	100.88
584	111.23		584	98.76
585	109.29		585	96.67
586	107.38		586	94.60
587	105.48		587	92.55
588	103.61		588	90.53
589	101.76		589	88.53
590	99.93		590	86.56
591	98.13		591	84.61
592	96.35		592	82.69
593	94.60		593	80.80
594	92.87		594	78.93
595	91.16		595	77.08
596	89.48		596	75.27
597	87.82		597	73.48
598	86.19		598	71.72
599	84.58		599	69.98
600	83.00		600	68.27
601	81.44		601	66.59
602	79.91		602	64.93
603	78.40		603	63.30
604	76.91		604	61.70
605	75.45		605	60.12
606	74.02		606	58.57
607	72.61		607	57.04
608	71.22		608	55.55
609	69.86		609	54.08
610	68.52		610	52.63
611	67.20		611	51.21
612	65.91		612	49.81
613	64.65		613	48.45
614	63.40		614	47.10
615	62.18		615	45.78
616	60.98		616	44.49
617	59.81		617	43.22
618	58.65		618	41.98
619	57.52		619	40.76
620	56.42		620	39.56
621	55.33		621	38.39
622	54.27		622	37.24
623	53.22		623	36.11
624	52.20		624	35.01
625	51.20		625	33.93
626	50.22		626	32.87
627	49.26		627	31.83
628	48.33		628	30.82
629	47.41		629	29.83
630	46.51		630	28.86
631	45.63		631	27.91
632	44.77		632	26.98
633	43.93		633	26.07
634	43.11		634	25.18
635	42.30		635	24.32
636	41.52		636	23.47
637	40.75		637	22.64
638	40.00		638	21.83
639	39.27		639	21.04
640	38.56		640	20.27
641	37.86		641	19.52
642	37.18		642	18.78
643	36.51		643	18.06
644	35.87		644	17.36
645	35.23		645	16.68
646	34.62		646	16.02
647	34.02		647	15.37
648	33.43		648	14.74
649	32.86		649	14.12
650	32.31		650	13.52
651	31.77		651	12.94
652	31.24		652	12.37
653	30.73		653	11.82
654	30.23		654	11.28
655	29.75		655	10.76
656	29.28		656	10.25
657	28.82		657	9.76
658	28.38		658	9.28
659	27.95		659	8.81
660	27.53		660	8.36
661	27.12		661	7.92
662	26.73		662	7.50
663	26.35		663	7.09
664	25.98		664	6.69
665	25.63		665	6.31
666	25.28		666	5.94
667	24.95		667	5.58
668	24.63		668	5.23
669	24.32		669	4.90
670	24.02		670	4.58
671	23.74		671	4.27
672	23.46		672	3.97
673	23.20		673	3.68
674	22.94		674	3.41
675	22.70		675	3.14
676	22.46		676	2.89
677	22.24		677	2.65
678	22.03		678	2.42
679	21.83		679	2.20
680	21.63		680	1.99
681	21.45		681	1.80
682	21.28		682	1.61
683	21.12		683	1.43
684	20.96		684	1.27
685	20.82		685	1.11
686	20.68		686	0.97
687	20.56		687	0.83
688	20.45		688	0.71
689	20.34		689	0.60
690	20.24		690	0.49
691	20.16		691	0.40
692	20.08		692	0.31
693	20.01		693	0.24
694	19.95		694	0.18
695	19.90		695	0.12
696	19.86		696	0.08
697	19.83		697	0.04
698	19.81		698	0.02
699	19.79		699	0.00
700	19.79		700	0.00
701	19.79		701	0.00
702	19.81		702	0.02
703	19.83		703	0.04
704	19.86		704	0.08
705	19.90		705	0.12
706	19.95		706	0.18
707	20.01		707	0.24
708	20.08		708	0.31
709	20.16		709	0.40
710	20.24		710	0.49
711	20.34		711	0.60
712	20.45		712	0.71
713	20.56		713	0.83
714	20.68		714	0.97
715	20.82		715	1.11
716	20.96		716	1.27
717	21.12		717	1.43
718	21.28		718	1.61
719	21.45		719	1.80
720	21.63		720	1.99
721	21.83		721	2.20
722	22.03		722	2.42
723	22.24		723	2.65
724	22.46		724	2.89
725	22.70		725	3.14
726	22.94		726	3.41
727	23.20		727	3.68
728	23.46		728	3.97
729	23.74		729	4.27
730	24.02		730	4.58
731	24.32		731	4.90
732	24.63		732	5.23
733	24.95		733	5.58
734	25.28		734	5.94
735	25.63		735	6.31
736	25.98		736	6.69
737	26.35		737	7.09
738	26.73		738	7.50
739	27.12		739	7.92
740	27.53		740	8.36
741	27.95		741	8.81
742	28.38		742	9.28
743	28.82		743	9.76
744	29.28		744	10.25
745	29.75		745	10.76
746	30.23		746	11.28
747	30.73		747	11.82
748	31.24		748	12.37
749	31.77		749	12.94
750	32.31		750	13.52
751	32.86		751	14.12
752	33.43		752	14.74
753	34.02		753	15.37
754	34.62		754	16.02
755	35.23		755	16.68
756	35.87		756	17.36
757	36.51		757	18.06
758	37.18		758	18.78
759	37.86		759	19.52
760	38.56		760	20.27
761	39.27		761	21.04
762	40.00		762	21.83
763	40.75		763	22.64
764	41.52		764	23.47
765	42.30		765	24.32
766	43.11		766	25.18
767	43.93		767	26.07
768	44.77		768	26.98
769	45.63		769	27.91
770	46.51		770	28.86
771	47.41		771	29.83
772	48.33		772	30.82
773	49.26		773	31.83
774	50.22		774	32.87
775	51.20		775	33.93
776	52.20		776	35.01
777	53.22		777	36.11
778	54.27		778	37.24
779	55.33		779	38.39
780	56.42		780	39.56
781	57.52		781	40.76
782	58.65		782	41.98
783	59.81		783	43.22
784	60.98		784	44.49
785	62.18		785	45.78
786	63.40		786	47.10
787	64.65		787	48.45
788	65.91		788	49.81
789	67.20		789	51.21
790	68.52		790	52.63
791	69.86		791	54.08
792	71.22		792	55.55
793	72.61		793	57.04
794	74.02		794	58.57
795	75.45		795	60.12
796	76.91		796	61.70
797	78.40		797	63.30
798	79.91		798	64.93
799	81.44		799	66.59
800	83.00		800	68.27
801	84.58		801	69.98
802	86.19		802	71.72
803	87.82		803	73.48
804	89.48		804	75.27
805	91.16		805	77.08
806	92.87		806	78.93
807	94.60		807	80.79
808	96.35		808	82.69
809	98.13		809	84.61
810	99.93		810	86.56
811	101.76		811	88.53
812	103.61		812	90.53
813	105.48		813	92.55
814	107.38		814	94.60
815	109.29		815	96.67
816	111.23		816	98.76
817	113.20		817	100.88
818	115.18		818	103.02
819	117.18		819	105.19
820	119.21		820	107.37
821	121.25		821	109.58
822	123.32		822	111.81
823	125.40		823	114.06
824	127.50		824	116.33
825	129.62		825	118.62
826	131.76		826	120.93
827	133.91		827	123.25
828	136.08		828	125.59
829	138.26		829	127.95
830	140.46		830	130.32
831	142.67		831	132.71
832	144.89		832	135.11
833	147.13		833	137.52
834	149.37		834	139.95
835	151.62		835	142.38
836	153.89		836	144.83
837	156.16		837	147.28
838	158.43		838	149.74
839	160.71		839	152.20
840	163.00		840	154.67
841	165.29		841	157.14
842	167.58		842	159.61
843	169.87		843	162.09
844	172.16		844	164.56
845	174.45		845	167.03
846	176.73		846	169.50
847	179.01		847	171.96
848	181.29		848	174.42
849	183.55		849	176.87
850	185.81		850	179.31
851	188.06		851	181.73
852	190.29		852	184.15
853	192.52		853	186.55
854	194.72		854	188.93
855	196.91		855	191.30
856	199.09		856	193.64
857	201.24		857	195.97
858	203.37		858	198.27
859	205.48		859	200.55
860	207.57		860	202.80
861	209.63		861	205.03
862	211.66		862	207.23
863	213.67		863	209.39
864	215.64		864	211.52
865	217.58		865	213.62
866	219.49		866	215.68
867	221.36		867	217.70
868	223.20		868	219.69
869	225.00		869	221.63
870	226.76		870	223.53
871	228.48		871	225.38
872	230.15		872	227.19
873	231.78		873	228.95
874	233.37		874	230.66
875	234.90		875	232.33
876	236.39		876	233.93
877	237.83		877	235.49
878	239.22		878	236.99
879	240.56		879	238.43
880	241.84		880	239.82
881	243.07		881	241.15
882	244.25		882	242.42
883	245.36		883	243.62
884	246.42		884	244.76
885	247.42		885	245.84
886	248.36		886	246.86
887	249.24		887	247.81
888	250.06		888	248.69
889	250.81		889	249.50
890	251.50		890	250.25
891	252.13		891	250.93
892	252.69		892	251.54
893	253.19		893	252.08
894	253.62		894	252.54
895	253.99		895	252.94
896	254.29		896	253.26
897	254.53		897	253.52
898	254.69		898	253.70
899	254.79		899	253.81
900	254.83		900	253.84
901	254.79		901	253.81
902	254.69		902	253.70
903	254.53		903	253.52
904	254.29		904	253.26
905	253.99		905	252.94
906	253.62		906	252.54
907	253.19		907	252.08
908	252.69		908	251.54
909	252.13		909	250.93
910	251.50		910	250.25
911	250.81		911	249.50
912	250.06		912	248.69
913	249.24		913	247.81
914	248.36		914	246.86
915	247.42		915	245.84
916	246.42		916	244.76
917	245.36		917	243.62
918	244.25		918	242.42
919	243.07		919	241.15
920	241.84		920	239.82
921	240.56		921	238.43
922	239.22		922	236.99
923	237.83		923	235.49
924	236.39		924	233.93
925	234.90		925	232.33
926	233.37		926	230.66
927	231.78		927	228.95
928	230.15		928	227.19
929	228.48		929	225.38
930	226.76		930	223.53
931	225.00		931	221.63
932	223.20		932	219.69
933	221.36		933	217.70
934	219.49		934	215.68
935	217.58		935	213.62
936	215.64		936	211.52
937	213.67		937	209.39
938	211.66		938	207.23
939	209.63		939	205.03
940	207.57		940	202.80
941	205.48		941	200.55
942	203.37		942	198.27
943	201.24		943	195.97
944	199.09		944	193.64
945	196.91		945	191.30
946	194.72		946	188.93
947	192.52		947	186.55
948	190.29		948	184.15
949	188.06		949	181.73
950	185.81		950	179.31
951	183.55		951	176.87
952	181.29		952	174.42
953	179.01		953	171.96
954	176.73		954	169.50
955	174.45		955	167.03
956	172.16		956	164.56
957	169.87		957	162.09
958	167.58		958	159.61
959	165.29		959	157.14
960	163.00		960	154.67
961	160.71		961	152.20
962	158.43		962	149.74
963	156.16		963	147.28
964	153.89		964	144.83
965	151.62		965	142.38
966	149.37		966	139.95
967	147.13		967	137.52
968	144.89		968	135.11
969	142.67		969	132.71
970	140.46		970	130.32
971	138.26		971	127.95
972	136.08		972	125.59
973	133.91		973	123.25
974	131.76		974	120.93
975	129.62		975	118.62
976	127.50		976	116.33
977	125.40		977	114.06
978	123.32		978	111.81
979	121.25		979	109.58
980	119.21		980	107.37
981	117.18		981	105.19
982	115.18		982	103.02
983	113.20		983	100.88
984	111.23		984	98.76
985	109.29		985	96.67
986	107.38		986	94.60
987	105.48		987	92.55
988	103.61		988	90.53
989	101.76		989	88.53
990	99.93		990	86.56
991	98.13		991	84.61
992	96.35		992	82.69
993	94.60		993	80.80
994	92.87		994	78.93
995	91.16		995	77.08
996	89.48		996	75.27
997	87.82		997	73.48
998	86.19		998	71.72
999	84.58		999	69.98
1000	83.00		1000	68.27
1001	81.44		1001	66.59
1002	79.91		1002	64.93
1003	78.40		1003	63.30
1004	76.91		1004	61.70
1005	75.45		1005	60.12
1006	74.02		1006	58.57
1007	72.61		1007	57.04
1008	71.22		1008	55.55
1009	69.86		1009	54.08
1010	68.52		1010	52.63
1011	67.20		1011	51.21
1012	65.91		1012	49.81
1013	64.65		1013	48.45
1014	63.40		1014	47.10
1015	62.18		1015	45.78
1016	60.98		1016	44.49
1017	59.81		1017	43.22
1018	58.65		1018	41.98
1019	57.52		1019	40.76
1020	56.42		1020	39.56
1021	55.33		1021	38.39
1022	54.27		1022	37.24
1023	53.22		1023	36.11
1024	52.20		1024	35.01
1025	51.20		1025	33.93
1026	50.22		1026	32.87
1027	49.26		1027	31.83
1028	48.33		1028	30.82
1029	47.41		1029	29.83
1030	46.51		1030	28.86
1031	45.63		1031	27.91
1032	44.77		1032	26.98
1033	43.93		1033	26.07
1034	43.11		1034	25.18
1035	42.30		1035	24.32
1036	41.52		1036	23.47
1037	40.75		1037	22.64
1038	40.00		1038	21.83
1039	39.27		1039	21.04
1040	38.56		1040	20.27
1041	37.86		1041	19.52
1042	37.18		1042	18.78
1043	36.51		1043	18.06
1044	35.87		1044	17.36
1045	35.23		1045	16.68
1046	34.62		1046	16.02
1047	34.02		1047	15.37
1048	33.43		1048	14.74
1049	32.86		1049	14.12
1050	32.31		1050	13.52
1051	31.77		1051	12.94
1052	31.24		1052	12.37
1053	30.73		1053	11.82
1054	30.23		1054	11.28
1055	29.75		1055	10.76
1056	29.28		1056	10.25
1057	28.82		1057	9.76
1058	28.38		1058	9.28
1059	27.95		1059	8.81
1060	27.53		1060	8.36
1061	27.12		1061	7.92
1062	26.73		1062	7.50
1063	26.35		1063	7.09
1064	25.98		1064	6.69
1065	25.63		1065	6.31
1066	25.28		1066	5.94
1067	24.95		1067	5.58
1068	24.63		1068	5.23
1069	24.32		1069	4.90
1070	24.02		1070	4.58
1071	23.74		1071	4.27
1072	23.46		1072	3.97
1073	23.20		1073	3.68
1074	22.94		1074	3.41
1075	22.70		1075	3.14
1076	22.46		1076	2.89
1077	22.24		1077	2.65
1078	22.03		1078	2.42
1079	21.83		1079	2.20
1080	21.63		1080	1.99
1081	21.45		1081	1.80
1082	21.28		1082	1.61
1083	21.12		1083	1.43
1084	20.96		1084	1.27
1085	20.82		1085	1.11
1086	20.68		1086	0.97
1087	20.56		1087	0.83
1088	20.45		1088	0.71
1089	20.34		1089	0.60
1090	20.24		1090	0.49
1091	20.16		1091	0.40
1092	20.08		1092	0.31
1093	20.01		1093	0.24
1094	19.95		1094	0.18
1095	19.90		1095	0.12
1096	19.86		1096	0.08
1097	19.83		1097	0.04
1098	19.81		1098	0.02
1099	19.79		1099	0.00
1100	19.79		1100	0.00
1101	19.79		1101	0.00
1102	19.81		1102	0.02
1103	19.83		1103	0.04
1104	19.86		1104	0.08
1105	19.90		1105	0.12
1106	19.95		1106	0.18
1107	20.01		1107	0.24
1108	20.08		1108	0.31
1109	20.16		1109	0.40
1110	20.24		1110	0.49
1111	20.34		1111	0.60
1112	20.45		1112	0.71
1113	20.56		1113	0.83
1114	20.68		1114	0.97
1115	20.82		1115	1.11
1116	20.96		1116	1.27
1117	21.12		1117	1.43
1118	21.28		1118	1.61
1119	21.45		1119	1.80
1120	21.63		1120	1.99
1121	21.83		1121	2.20
1122	22.03		1122	2.42
1123	22.24		1123	2.65
1124	22.46		1124	2.89
1125	22.70		1125	3.14
1126	22.94		1126	3.41
1127	23.20		1127	3.68
1128	23.46		1128	3.97
1129	23.74		1129	4.27
1130	24.02		1130	4.58
1131	24.32		1131	4.90
1132	24.63		1132	5.23
1133	24.95		1133	5.58
1134	25.28		1134	5.94
1135	25.63		1135	6.31
1136	25.98		1136	6.69
1137	26.35		1137	7.09
1138	26.73		1138	7.50
1139	27.12		1139	7.92
1140	27.53		1140	8.36
1141	27.95		1141	8.81
1142	28.38		1142	9.28
1143	28.82		1143	9.76
1144	29.28		1144	10.25
1145	29.75		1145	10.76
1146	30.23		1146	11.28
1147	30.73		1147	11.82
1148	31.24		1148	12.37
1149	31.77		1149	12.94
1150	32.31		1150	13.52
1151	32.86		1151	14.12
1152	33.43		1152	14.74
1153	34.02		1153	15.37
1154	34.62		1154	16.02
1155	35.23		1155	16.68
1156	35.87		1156	17.36
1157	36.51		1157	18.06
1158	37.18		1158	18.78
1159	37.86		1159	19.52
1160	38.56		1160	20.27
1161	39.27		1161	21.04
1162	40.00		1162	21.83
1163	40.75		1163	22.64
1164	41.52		1164	23.47
1165	42.30		1165	24.32
1166	43.11		1166	25.18
1167	43.93		1167	26.07
1168	44.77		1168	26.98
1169	45.63		1169	27.91
1170	46.51		1170	28.86
1171	47.41		1171	29.83
1172	48.33		1172	30.82
1173	49.26		1173	31.83
1174	50.22		1174	32.87
1175	51.20		1175	33.93
1176	52.20		1176	35.01
1177	53.22		1177	36.11
1178	54.27		1178	37.24
1179	55.33		1179	38.39
1180	56.42		1180	39.56
1181	57.52		1181	40.76
1182	58.65		1182	41.98
1183	59.81		1183	43.22
1184	60.98		1184	44.49
1185	62.18		1185	45.78
1186	63.40		1186	47.10
1187	64.65		1187	48.45
1188	65.91		1188	49.81
1189	67.20		1189	51.21
1190	68.52		1190	52.63
1191	69.86		1191	54.08
1192	71.22		1192	55.55
1193	72.61		1193	57.04
1194	74.02		1194	58.57
1195	75.45		1195	60.12
1196	76.91		1196	61.70
1197	78.40		1197	63.30
1198	79.91		1198	64.93
1199	81.44		1199	66.59
1200	83.00		1200	68.27
1201	84.58		1201	69.98
1202	86.19		1202	71.72
1203	87.82		1203	73.48
1204	89.48		1204	75.27
1205	91.16		1205	77.08
1206	92.87		1206	78.93
1207	94.60		1207	80.80
1208	96.35		1208	82.69
1209	98.13		1209	84.61
1210	99.93		1210	86.56
1211	101.76		1211	88.53
1212	103.61		1212	90.53
1213	105.48		1213	92.55
1214	107.38		1214	94.60
1215	109.29		1215	96.67
1216	111.23		1216	98.76
1217	113.20		1217	100.88
1218	115.18		1218	103.02
1219	117.18		1219	105.19
1220	119.21		1220	107.37
1221	121.25		1221	109.58
1222	123.32		1222	111.81
1223	125.40		1223	114.06
1224	127.50		1224	116.33
1225	129.62		1225	118.62
1226	131.76		1226	120.93
1227	133.91		1227	123.25
1228	136.08		1228	125.59
1229	138.26		1229	127.95
1230	140.46		1230	130.32
1231	142.67		1231	132.71
1232	144.89		1232	135.11
1233	147.13		1233	137.52
1234	149.37		1234	139.95
1235	151.62		1235	142.38
1236	153.89		1236	144.83
1237	156.16		1237	147.28
1238	158.43		1238	149.74
1239	160.71		1239	152.20
1240	163.00		1240	154.67
1241	165.29		1241	157.14
1242	167.58		1242	159.61
1243	169.87		1243	162.09
1244	172.16		1244	164.56
1245	174.45		1245	167.03
1246	176.73		1246	169.50
1247	179.01		1247	171.96
1248	181.29		1248	174.42
1249	183.55		1249	176.87
1250	185.81		1250	179.31
1251	188.06		1251	181.73
1252	190.29		1252	184.15
1253	192.52		1253	186.55
1254	194.72		1254	188.93
1255	196.91		1255	191.30
1256	199.09		1256	193.64
1257	201.24		1257	195.97
1258	203.37		1258	198.27
1259	205.48		1259	200.55
1260	207.57		1260	202.80
1261	209.63		1261	205.03
1262	211.66		1262	207.23
1263	213.67		1263	209.39
1264	215.64		1264	211.52
1265	217.58		1265	213.62
1266	219.49		1266	215.68
1267	221.36		1267	217.70
1268	223.20		1268	219.69
1269	225.00		1269	221.63
1270	226.76		1270	223.53
1271	228.48		1271	225.38
1272	230.15		1272	227.19
1273	231.78		1273	228.95
1274	233.37		1274	230.66
1275	234.90		1275	232.33
1276	236.39		1276	233.93
1277	237.83		1277	235.49
1278	239.22		1278	236.99
1279	240.56		1279	238.43
1280	241.84		1280	239.82
1281	243.07		1281	241.15
1282	244.25		1282	242.41
1283	245.36		1283	243.62
1284	246.42		1284	244.76
1285	247.42		1285	245.84
1286	248.36		1286	246.86
1287	249.24		1287	247.81
1288	250.06		1288	248.69
1289	250.81		1289	249.50
1290	251.50		1290	250.25
1291	252.13		1291	250.93
1292	252.69		1292	251.54
1293	253.19		1293	252.08
1294	253.62		1294	252.54
1295	253.99		1295	252.94
1296	254.29		1296	253.26
1297	254.53		1297	253.52
1298	254.69		1298	253.70
1299	254.79		1299	253.81
1300	254.83		1300	253.84
1301	254.79		1301	253.81
1302	254.69		1302	253.70
1303	254.53		1303	253.52
1304	254.29		1304	253.26
1305	253.99		1305	252.94
1306	253.62		1306	252.54
1307	253.19		1307	252.08
1308	252.69		1308	251.54
1309	252.13		1309	250.93
1310	251.50		1310	250.25
1311	250.81		1311	249.50
1312	250.06		1312	248.69
1313	249.24		1313	247.81
1314	248.36		1314	246.86
1315	247.42		1315	245.84
1316	246.42		1316	244.76
1317	245.36		1317	243.62
1318	244.25		1318	242.42
1319	243.07		1319	241.15
1320	241.84		1320	239.82
1321	240.56		1321	238.43
1322	239.22		1322	236.99
1323	237.83		1323	235.49
1324	236.39		1324	233.93
1325	234.90		1325	232.33
1326	233.37		1326	230.66
1327	231.78		1327	228.95
1328	230.15		1328	227.19
1329	228.48		1329	225.38
1330	226.76		1330	223.53
1331	225.00		1331	221.63
1332	223.20		1332	219.69
1333	221.36		1333	217.70
1334	219.49		1334	215.68
1335	217.58		1335	213.62
1336	215.64		1336	211.52
1337	213.67		1337	209.39
1338	211.66		1338	207.23
1339	209.63		1339	205.03
1340	207.57		1340	202.80
1341	205.48		1341	200.55
1342	203.37		1342	198.27
1343	201.24		1343	195.97
1344	199.09		1344	193.64
1345	196.91		1345	191.30
1346	194.72		1346	188.93
1347	192.52		1347	186.55
1348	190.29		1348	184.15
1349	188.06		1349	181.73
1350	185.81		1350	179.31
1351	183.55		1351	176.87
1352	181.29		1352	174.42
1353	179.01		1353	171.96
1354	176.73		1354	169.50
1355	174.45		1355	167.03
1356	172.16		1356	164.56
1357	169.87		1357	162.09
1358	167.58		1358	159.61
1359	165.29		1359	157.14
1360	163.00		1360	154.67
1361	160.71		1361	152.20
1362	158.43		1362	149.74
1363	156.16		1363	147.28
1364	153.89		1364	144.83
1365	151.62		1365	142.38
1366	149.37		1366	139.95
1367	147.13		1367	137.52
1368	144.89		1368	135.11
1369	142.67		1369	132.71
1370	140.46		1370	130.32
1371	138.26		1371	127.95
1372	136.08		1372	125.59
1373	133.91		1373	123.25
1374	131.76		1374	120.93
1375	129.62		1375	118.62
1376	127.50		1376	116.33
1377	125.40		1377	114.06
1378	123.32		1378	111.81
1379	121.25		1379	109.58
1380	119.21		1380	107.37
1381	117.18		1381	105.19
1382	115.18		1382	103.02
1383	113.20		1383	100.88
1384	111.23		1384	98.76
1385	109.29		1385	96.67
1386	107.38		1386	94.60
1387	105.48		1387	92.55
1388	103.61		1388	90.53
1389	101.76		1389	88.53
1390	99.93		1390	86.56
1391	98.13		1391	84.61
1392	96.35		1392	82.69
1393	94.60		1393	80.79
1394	92.87		1394	78.93
1395	91.16		1395	77.08
1396	89.48		1396	75.27
1397	87.82		1397	73.48
1398	86.19		1398	71.72
1399	84.58		1399	69.98
1400	83.00		1400	68.27
1401	81.44		1401	66.59
1402	79.91		1402	64.93
1403	78.40		1403	63.30
1404	76.91		1404	61.70
1405	75.45		1405	60.12
1406	74.02		1406	58.57
1407	72.61		1407	57.04
1408	71.22		1408	55.55
1409	69.86		1409	54.08
1410	68.52		1410	52.63
1411	67.20		1411	51.21
1412	65.91		1412	49.81
1413	64.64		1413	48.45
1414	63.40		1414	47.10
1415	62.18		1415	45.78
1416	60.98		1416	44.49
1417	59.81		1417	43.22
1418	58.65		1418	41.98
1419	57.52		1419	40.76
1420	56.42		1420	39.56
1421	55.33		1421	38.39
1422	54.27		1422	37.24
1423	53.22		1423	36.11
1424	52.20		1424	35.01
1425	51.20		1425	33.93
1426	50.22		1426	32.87
1427	49.26		1427	31.83
1428	48.33		1428	30.82
1429	47.41		1429	29.83
1430	46.51		1430	28.86
1431	45.63		1431	27.91
1432	44.77		1432	26.98
1433	43.93		1433	26.07
1434	43.11		1434	25.18
1435	42.30		1435	24.32
1436	41.52		1436	23.47
1437	40.75		1437	22.64
1438	40.00		1438	21.83
1439	39.27		1439	21.04
1440	38.56		1440	20.27
1441	37.86		1441	19.52
1442	37.18		1442	18.78
1443	36.51		1443	18.06
1444	35.87		1444	17.36
1445	35.23		1445	16.68
1446	34.62		1446	16.02
1447	34.02		1447	15.37
1448	33.43		1448	14.74
1449	32.86		1449	14.12
1450	32.31		1450	13.52
1451	31.77		1451	12.94
1452	31.24		1452	12.37
1453	30.73		1453	11.82
1454	30.23		1454	11.28
1455	29.75		1455	10.76
1456	29.28		1456	10.25
1457	28.82		1457	9.76
1458	28.38		1458	9.28
1459	27.95		1459	8.81
1460	27.53		1460	8.36
1461	27.12		1461	7.92
1462	26.73		1462	7.50
1463	26.35		1463	7.09
1464	25.98		1464	6.69
1465	25.63		1465	6.31
1466	25.28		1466	5.94
1467	24.95		1467	5.58
1468	24.63		1468	5.23
1469	24.32		1469	4.90
1470	24.02		1470	4.58
1471	23.74		1471	4.27
1472	23.46		1472	3.97
1473	23.20		1473	3.68
1474	22.94		1474	3.41
1475	22.70		1475	3.14
1476	22.46		1476	2.89
1477	22.24		1477	2.65
1478	22.03		1478	2.42
1479	21.83		1479	2.20
1480	21.63		1480	1.99
1481	21.45		1481	1.80
1482	21.28		1482	1.61
1483	21.12		1483	1.43
1484	20.96		1484	1.27
1485	20.82		1485	1.11
1486	20.68		1486	0.97
1487	20.56		1487	0.83
1488	20.45		1488	0.71
1489	20.34		1489	0.60
1490	20.24		1490	0.49
1491	20.16		1491	0.40
1492	20.08		1492	0.31
1493	20.01		1493	0.24
1494	19.95		1494	0.18
1495	19.90		1495	0.12
1496	19.86		1496	0.08
1497	19.83		1497	0.04
1498	19.81		1498	0.02
1499	19.79		1499	0.00

If you compare minimum and maximum they occur at the same numbers but the values are reduced to 20 - 254
best regards Stefan

That looks a lot like it will take longer than an analog read even if you weren't using float math.

Why i say TABLE is that the trig functions and exp are done through series calculations that eat cycles by the hundreds but there are 16000 cycles per ms so you won't notice but close timing will.

Yup. But for what ever reason, @mastino2 is OK with that. So as long as he's gone down the float, trig, exp road, just keep going, per Churchill :laughing:

So, simply take the result of the original function, scale it by 235.0 / 255.0 and add 20.

A fine example of a solution that is not optimized for microcontrollers.

Compute a table in Excel/LibreOfficeCalc/Whatever, and drop it in a LUT. Each value is only an 8-bit unsigned integer.

Your update rate should be determined by the rate at which you wish to 'breathe'. If 10 breaths per minute is the target, and you store 600 values, you'll update at 10 mS. If you decide to 'breathe' at 100 breaths per minute, you update at 1mS. Extrapolate those to the desired ends, and cut or increase your data as necessary.
If your data contains a lot of points consecutively at the min value, consider making the min value a keyword, which is always followed by a count.
Consider, with a key value of 0:
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
vs
0,17,1,2,3,2,1,0,25
In this case, a 50-sample run is compressed to 9 bytes.
Your limitation will be the number of values you can store, sure, but at least it won't be computation-constipated.
Just an alternative viewpoint, from a micro-dinosaur. All presumes a constant update rate, of course, though that could also be finessed with a flag value if necessary.

2 Likes

As pointed out, @mastino2 hasn't complained about the speed or appearance of the current solution. Are you suggesting he solve a problem that he doesn't have?

Nope, just pointing out there are alternatives. Sorry to offend, @gfvalvo.

1 Like

was chosen because it is exp(-1.0).

As the entire sin curve runs from -1 to 1, so the exp will go from 0.3678 to 2.7183, thus informing the scaling factor if you are aiming for 235 (255 - 20) range, and the offset of 20 if it is indeed to go from 20 to 255.

This is very good, the constant is very close to 100. I would in all cases use some constraint on the floating point number to integer code. The AI code had suggested gurading against go below 20, you could add not going over 255, although neither happens in the first few seconds of the equation with 100 as the scale factor.

    val = (exp(sin(i/2000.0*PI*10)) - 0.36787944) * 100; // Adjust the scaling factor
    val = val + 20; // Shift the range by -20

HTH

a7

You need to adjust the calculated value.
Do you think this would work?

float val = ( exp ( sin (i/2000.0PI10)) - 0.36787944)*108.0;
val = 20 + val * ( (255-20) / 255.0); // do NOT ommit the decimal point

He has a problem in generating values that might be easier to solve on a PC, but maybe the idea of doing that is outside of the OP's box.

I think the questioner should take another look at the basics of trigonometry.