ZEO-S 제품 자료입니다.
Timer 를 이용하여 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_Flow2 { public partial class Form1 : Form { // LED 상태 int iStatus = 0;
// ZEO-S 인스턴스 ZeoLib ZEO = new ZeoLib();
public Form1() { InitializeComponent(); }
private void Form1_Load(object sender, EventArgs e) { // ZEO 초기화 this.ZEO.Open(); if (this.ZEO.IsOpened) { this.ZEO.InitZeo(0); this.ZEO.PORT_DirOutputALL(); this.ZEO.Pin_Set(this.ZEO.PIN_ALL); } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { // ZEO 닫기 if (this.ZEO.IsOpened) this.ZEO.Close(); }
private void timer1_Tick(object sender, EventArgs e) { if (!this.ZEO.IsOpened) { Console.WriteLine("ZEO-S 가 연결되어 있지 않습니다."); return; }
switch (iStatus) { case 0: this.ZEO.Pin_Reset(PIN_NAME.PA0); break; case 1: this.ZEO.Pin_Reset(PIN_NAME.PA2); break; case 2: this.ZEO.Pin_Reset(PIN_NAME.PA4); break; case 3: this.ZEO.Pin_Reset(PIN_NAME.PA6); break;
case 4: this.ZEO.Pin_Set(PIN_NAME.PA0); break; case 5: this.ZEO.Pin_Reset(PIN_NAME.PA8); break; case 6: this.ZEO.Pin_Set(PIN_NAME.PA2); break; case 7: this.ZEO.Pin_Reset(PIN_NAME.PA10); break; case 8: this.ZEO.Pin_Set(PIN_NAME.PA4); break; case 9: this.ZEO.Pin_Reset(PIN_NAME.PA16); break; case 10: this.ZEO.Pin_Set(PIN_NAME.PA6); break; case 11: this.ZEO.Pin_Reset(PIN_NAME.PA1); break;
case 12: this.ZEO.Pin_Set(PIN_NAME.PA8); break; case 13: this.ZEO.Pin_Reset(PIN_NAME.PA3); break; case 14: this.ZEO.Pin_Set(PIN_NAME.PA10); break; case 15: this.ZEO.Pin_Reset(PIN_NAME.PA5); break; case 16: this.ZEO.Pin_Set(PIN_NAME.PA16); break; case 17: this.ZEO.Pin_Reset(PIN_NAME.PA7); break;
case 18: this.ZEO.Pin_Set(PIN_NAME.PA1); break; case 19: this.ZEO.Pin_Reset(PIN_NAME.PA9); break; case 20: this.ZEO.Pin_Set(PIN_NAME.PA3); break; case 21: this.ZEO.Pin_Reset(PIN_NAME.PA11); break; case 22: this.ZEO.Pin_Set(PIN_NAME.PA5); break; case 23: this.ZEO.Pin_Reset(PIN_NAME.PB0); break;
case 24: this.ZEO.Pin_Set(PIN_NAME.PA7); break; case 25: this.ZEO.Pin_Reset(PIN_NAME.PB2); break; case 26: this.ZEO.Pin_Set(PIN_NAME.PA9); break; case 27: this.ZEO.Pin_Reset(PIN_NAME.PB4); break; case 28: this.ZEO.Pin_Set(PIN_NAME.PA11); break; case 29: this.ZEO.Pin_Reset(PIN_NAME.PB6); break;
case 30: this.ZEO.Pin_Set(PIN_NAME.PB0); break; case 31: this.ZEO.Pin_Reset(PIN_NAME.PB9); break;
case 32: this.ZEO.Pin_Set(PIN_NAME.PB2); break; case 33: this.ZEO.Pin_Reset(PIN_NAME.PB11); break; case 34: this.ZEO.Pin_Set(PIN_NAME.PB4); break; case 35: this.ZEO.Pin_Reset(PIN_NAME.PB1); break; case 36: this.ZEO.Pin_Set(PIN_NAME.PB6); break; case 37: this.ZEO.Pin_Reset(PIN_NAME.PB3); break; case 38: this.ZEO.Pin_Set(PIN_NAME.PB9); break; case 39: this.ZEO.Pin_Reset(PIN_NAME.PB5); break; case 40: this.ZEO.Pin_Set(PIN_NAME.PB11); break; case 41: this.ZEO.Pin_Reset(PIN_NAME.PB7); break; case 42: this.ZEO.Pin_Set(PIN_NAME.PB1); break; case 43: this.ZEO.Pin_Reset(PIN_NAME.PB8); break; case 44: this.ZEO.Pin_Set(PIN_NAME.PB3); break; case 45: this.ZEO.Pin_Reset(PIN_NAME.PB10); break;
case 46: this.ZEO.Pin_Set(PIN_NAME.PB5); break; case 47: this.ZEO.Pin_Reset(PIN_NAME.PA0); break; case 48: this.ZEO.Pin_Set(PIN_NAME.PB7); break; case 49: this.ZEO.Pin_Reset(PIN_NAME.PA2); break; case 50: this.ZEO.Pin_Set(PIN_NAME.PB8); break; case 51: this.ZEO.Pin_Reset(PIN_NAME.PA4); break; case 52: this.ZEO.Pin_Set(PIN_NAME.PB10); break; default: iStatus = 2;
break; }
iStatus++;
} } } |
전체 코드 Visual C# 2008 용
- [2015/06/08] ZEO-S C++ 라이브러리 ver. 1.01 (0)
- [2015/06/01] ZEO-S C++ 라이브러리 ver. 1.0 (0)
- [2015/04/15] 부저 실험 (7099)
- [2015/03/15] 블루투스로 스텝모터 제어 (4821)
- [2015/03/15] 시리얼 포트로 스텝모터 제어 (3319)
- [2014/11/28] 컴퓨터-아두이노 간의 블루투스 통신 (채팅) (4806)
- [2014/05/13] 0. 3개 이상의 Multi Task 작업 (3845)
- [2014/04/18] 0. LED 깜박이기 (3114)
- [2013/10/30] ZEO-S, CDS로 빛 밝기 -> LED ON/OFF ()
- [2013/10/28] ZEO-IO2 BOARD [ZEO IO 실험 보드2] ()