aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Stubs Collection/stubs/Breathing LED.cs
blob: 197fcb5972e74e7a85b5b98eaeb716097fa5c513 (plain)
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
using System;
using System.Text;
using System.Linq;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Tango.PMR.Stubs;
using Tango.Stubs;

public void OnExecute(StubManager stubManager)
{
	int LOW = 0;//0 - 100%
	
	var response  = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x112, 0xFF);//Freq 8 bit
	while(true)
	{
		for(LOW=0;LOW<100;LOW++)
		{
		var response1 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EC, LOW+1);//Low 8 bit
		var response2 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EE, 101 - LOW);//High 8 bit 
		
		
		Thread.Sleep(14-((LOW*10+50)/100)); //Sleep for 10 milli.
		}
		Thread.Sleep(500);
		
		for(LOW = 100; LOW>0;LOW--)
		{
		var response1 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EC, LOW+1);//Low 8 bit
		var response2 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EE, 101 - LOW);//High 8 bit 
		Thread.Sleep(14-((LOW*10+50)/100)); //Sleep for 10 milli.
		}
		
	}
	
	// low + high = 100 % in order use the same freq 
	// there is option to change only the high (low + freq constasnt) this will chnga the freq
}