메뉴 바로가기

서브메뉴 바로가기

본문 바로가기

logo

문의(질문)하기

문의하기
ZEO 자료실
ZEO 자료실
ZEO-S 제품 자료입니다.

Timer 의 Interval 값을 조정하여 LED 이동속도를 조절하는 예제입니다.

 

 

 

 

 

 

 

 

동영상

 

 


 

 

 

 

코드 C#

 

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using ZeoDotNetLib;

 

namespace ZEO_Flow

{

public partial class Form1 : Form

{

const int STEP = 25;

int iStatus = 0;

int NowStep = -STEP;

 

PIN_NAME pin1 = PIN_NAME.PA0 | PIN_NAME.PA2| PIN_NAME.PA4 | PIN_NAME.PA6

| PIN_NAME.PA8 | PIN_NAME.PA10 | PIN_NAME.PA16;

PIN_NAME pin2 = PIN_NAME.PA1 | PIN_NAME.PA3 | PIN_NAME.PA5 | PIN_NAME.PA7

| PIN_NAME.PA9 | PIN_NAME.PA11;

PIN_NAME pin3 = PIN_NAME.PB0 | PIN_NAME.PB2 | PIN_NAME.PB4 | PIN_NAME.PB6

| PIN_NAME.PB9 | PIN_NAME.PB11;

PIN_NAME pin4 = PIN_NAME.PB1 | PIN_NAME.PB3 | PIN_NAME.PB5 | PIN_NAME.PB7

| PIN_NAME.PB8 | PIN_NAME.PB10;

 

ZeoLib ZEO = new ZeoLib();

public Form1()

{

InitializeComponent();

}

 

private void Form1_Load(object sender, EventArgs e)

{

this.ZEO.Open();

this.ZEO.InitZeo(0);

this.ZEO.PORT_DirOutputALL();

this.ZEO.Pin_Set(this.ZEO.PIN_ALL);

}

 

private void Form1_FormClosing(object sender, FormClosingEventArgs e)

{

this.ZEO.Close();

}

 

private void timer1_Tick(object sender, EventArgs e)

{

if (timer1.Interval < 200)

{

timer1.Interval += NowStep/10;

}

else

{

timer1.Interval += NowStep;

}

 

if (timer1.Interval < 100)

{

NowStep = STEP;

}

else if (timer1.Interval > 1000)

{

NowStep = -STEP;

}

 

 

Console.WriteLine("int:"+timer1.Interval.ToString() +", nowstep:"+NowStep.ToString() );

 

switch (iStatus)

{

case 0:

this.ZEO.Pin_Reset(pin1);

this.ZEO.Pin_Set(pin4);

break;

case 1:

this.ZEO.Pin_Reset(pin2);

this.ZEO.Pin_Set(pin1);

 

break;

case 2:

this.ZEO.Pin_Reset(pin3);

this.ZEO.Pin_Set(pin2);

break;

case 3:

this.ZEO.Pin_Reset(pin4);

this.ZEO.Pin_Set(pin3);

break;

default:

break;

}

 

iStatus = (++iStatus)%4;

}

}

}

 

 

 

전체 코드 Visual C# 2008 용


 다운로드



 

 

 

관련 문서가 검색되었습니다.
  1. [2015/06/08] ZEO-S C++ 라이브러리 ver. 1.01 by WhiteAT (0)
  2. [2015/06/01] ZEO-S C++ 라이브러리 ver. 1.0 by WhiteAT (0)
  3. [2015/04/15] 부저 실험 by WhiteAT (7099)
  4. [2015/03/15] 블루투스로 스텝모터 제어 by WhiteAT (4821)
  5. [2015/03/15] 시리얼 포트로 스텝모터 제어 by WhiteAT (3319)
  6. [2014/11/28] 컴퓨터-아두이노 간의 블루투스 통신 (채팅) by WhiteAT (4806)
  7. [2014/05/13] 0. 3개 이상의 Multi Task 작업 by WhiteAT (3845)
  8. [2014/04/18] 0. LED 깜박이기 by WhiteAT (3114)
  9. [2013/10/30] ZEO-S, CDS로 빛 밝기 -> LED ON/OFF by WhiteAT ()
  10. [2013/10/28] ZEO-IO2 BOARD [ZEO IO 실험 보드2] by WhiteAT (6465)
사진 및 파일 첨부

여기에 파일을 끌어 놓거나 왼쪽의 버튼을 클릭하세요.

파일 용량 제한 : 0MB (허용 확장자 : *.*)

0개 첨부 됨 ( / )
List of Articles
번호 제목
공지 예제 ZEO 예제
공지 일반 ZEO 모듈,매뉴얼,드라이버,라이브러리,관리툴
6 예제 ZEO-S, CDS로 빛 밝기 -> LED ON/OFF
5 예제 ZEO-S PWM 펄스를 Pulse Counter로 읽기, C#
4 예제 ZEO-S, Pulse Counter, C#
3 예제 ZEO-S, 스위치로 LED ON/OFF, C#
2 예제 ZEO-S, LED 연속으로 이동, C#
» 예제 ZEO-S, LED 이동 속도 조절, C#