示例#1
0
文件: Ex_Ctrl.cpp 项目: smithLiLi/dev
void CEx_Ctrl::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();
	
	// TODO: Add your specialized code here and/or call the base class
    m_sp_pw.SetBuddy(&m_sel_pw);
    m_sp_pw.SetRange(1, 10);
    m_sp_pw.SetPos(1);

    m_lists.ResetContent();

    m_sel_graph.AddString(_T("0 - 选择模式"));
    m_sel_graph.AddString(_T("1 - 直线"));
    m_sel_graph.AddString(_T("2 - 矩形"));
    m_sel_graph.AddString(_T("3 - 椭圆"));
    m_sel_graph.AddString(_T("4 - 曲线"));
    m_sel_graph.SetCurSel(0);

    int i;
    for (i = 0; i < 6; i++)
    {
        m_sel_ps.AddString(CGraphic::GetPenStyleById(i));
    }
    m_sel_ps.SetCurSel(0);

    for (i = 0; i < 8; i++)
    {
        m_sel_bs.AddString(CGraphic::GetBrushStyleById(i));
    }
    m_sel_bs.SetCurSel(0);

    DisplayRGB();
    OnSelGraph();
}
//*******************************************************
//               SETUP
//*******************************************************
void setup(){
  Serial.begin(9600);
  Serial.println("Starting Slave...");
  delay(2000);
  //Fast-SPI initialisieren
  FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);

  //Zuerst PWM-Treiber disable
  Serial.println("Set PWM off");
  pinMode(Enable,OUTPUT);
  digitalWrite(Enable,LOW);
  DisplayRGB(0,0,0);//LED-Streifen auf Schwarz
  delay(1000);

  Serial.println("Set SPI off");
  //Alle Fast-SPI-Lampen aus
  for (int a=0;a<NUM_LEDS;a++){
    leds[a]=CRGB::Black;
  }
  Serial.println("Init RS485");
  //RS485 Initialisieren
  rs485.begin (9600);
  pinMode (ENABLE_PIN, OUTPUT);  // driver output enable
  Serial.println("Start loop...");
}
示例#3
0
void SetLight()
{
	 
	boolean RedUP=false;
	boolean RedDown=false;
	boolean GreenUP=false;
	boolean GreenDown=false;
	boolean BlueUP=false;
	boolean BlueDown=false;
	 
	if (ActualValue[actualChannel].r < TargetValue[actualChannel].r){RedUP=true;Serial.println("Red up");}
	if (ActualValue[actualChannel].r > TargetValue[actualChannel].r){RedDown=true;Serial.println("Red down");}
	if (ActualValue[actualChannel].g < TargetValue[actualChannel].g){GreenUP=true;Serial.println("Green up");}
	if (ActualValue[actualChannel].g > TargetValue[actualChannel].g){GreenDown=true;Serial.println("Green down");}
	if (ActualValue[actualChannel].b < TargetValue[actualChannel].b){BlueUP=true;Serial.println("Blue up");}
	if (ActualValue[actualChannel].b > TargetValue[actualChannel].b){BlueDown=true;Serial.println("Blue down");}
	 
	Serial.print("Channel: ");
	Serial.println(actualChannel);
	Serial.println(ActualValue[actualChannel].r);
	Serial.println(TargetValue[actualChannel].r);
	Serial.println("---");
	 
	if(RedUP){ ActualValue[actualChannel].r++;Serial.println("Red add");}
	if(RedDown){ ActualValue[actualChannel].r--;Serial.println("Red sub");}
	if(GreenUP){ ActualValue[actualChannel].g++;Serial.println("Green add");}
	if(GreenDown){ ActualValue[actualChannel].g--;Serial.println("Green sub");}
	if(BlueUP){ ActualValue[actualChannel].b++;Serial.println("Blue add");}
	if(BlueDown){ ActualValue[actualChannel].b--;Serial.println("Blue sub");}
	 
	if (actualChannel==0) //LED-Streifen Schalten
	{
		 
		DisplayRGB(ActualValue[actualChannel].r,ActualValue[actualChannel].g,ActualValue[actualChannel].b); //PWM ausgeben
	}
	if (actualChannel==1)
	{
		//Fast-SPI selben Wert wie LED-Streifen zuweisen
		for(int a=0;a<NUM_LEDS;a++){
			leds[a].red = ActualValue[actualChannel].r;
			leds[a].green= ActualValue[actualChannel].g;
			leds[a].blue= ActualValue[actualChannel].b;
			FastLED.show(); //Fast-SPI LED Wert anzeigen
		}
		 
	}
	 
	//test if all values are reached.
	if (
	(ActualValue[actualChannel].r == TargetValue[actualChannel].r) &
	(ActualValue[actualChannel].g == TargetValue[actualChannel].g) &
	(ActualValue[actualChannel].b == TargetValue[actualChannel].b)
	) ValueReached[actualChannel]=true;
	 
}
示例#4
0
文件: Ex_Ctrl.cpp 项目: smithLiLi/dev
void CEx_Ctrl::OnChangeBrushColor() 
{
    // TODO: Add your control notification handler code here
    CColorDialog dlg(GetDocument()->m_GM.m_iBrushStyle);
    if (dlg.DoModal() == IDOK)
    {
        GetDocument()->m_GM.m_clrBrush = dlg.GetColor();
        Invalidate();
        DisplayRGB();
    }
}
示例#5
0
//*******************************************************
//               SETUP
//*******************************************************
void setup(){
  //Fast-SPI initialisieren
  FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);

  //Zuerst PWM-Treiber disable
  Serial.println("Set PWM off");
  pinMode(RelayPin,OUTPUT);
  digitalWrite(RelayPin,LOW);
  analogWrite(ColumnPin,0);
  DisplayRGB(0,0,0);//LED-Streifen auf Schwarz
  
for(int a=0;a<NUM_LEDS;a++){
			leds[a].red = 0;
			leds[a].green= 0;
			leds[a].blue= 0;
			FastLED.show(); //Fast-SPI LED Wert anzeigen
		}

Serial.begin(9600);
  Serial.println("Starting Slave...");
  delay(1000);
  

  Serial.println("Set SPI off");
  //Alle Fast-SPI-Lampen aus
  for (int a=0;a<NUM_LEDS;a++){
    leds[a]=CRGB::Black;
  }
  Serial.println("Init RS485");
  //RS485 Initialisieren
  rs485.begin (9600);
  pinMode (ENABLE_PIN, OUTPUT);  // driver output enable
  Serial.println("Start loop...");
  
  
  //*************Init ohne RS485 ***************
  for (int i=0;i<5;i++)
  {
	TargetValue[i].r=136;
	TargetValue[i].g=40;
	TargetValue[i].b=0;
	}
	//***************** INIT END ****************
}