Moxa TC-6110-W7E [69/74] The led control script

Moxa TC-6110-CT-T-W7E [69/74] The led control script
TC-6110 / Windows 7 Sample Code for TC-6110 Customization
B-2
The LED Control Script
Below we reproduce the LED control code. This is a simple script that users may freely modify this code to suit
their needs.
/* Copyright (C) MOXA Inc. All rights reserved.
This software is distributed under the terms of the
MOXA License. See the file COPYING-MOXA for details.
*/
#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>
#include "devices.h"
/*
index[n]: 0 ; BIT 0
1 ; BIT 1
2 ; BIT 2
3 ; BIT 3
....
data[n]: 0 ; Digital LOW
1 ; Digital HIGH
*/
#define LED_NUMBER 8
int LEDMap[8] = {0, 1, 2, 3, 6, 7, 9, 10};
int _tmain(int argc, _TCHAR* argv[])
{
HANDLE hGPIO;
int led_no;
int data;
int nLED = 0;
int nRet = 0;
int n = 0;
WCHAR sin,smode;
printf("LED Test Program\n");
printf("\t (0) Exit Program\n");
printf("\t (1) Display LED\n");
printf("\t (2) Set LED value\n");
sin = getwchar();
n = _wtoi(&sin);
do
{
switch (n)
{
// if char == '1', display the digital input
case 1:
//Open dio
hGPIO = mxgpio_open();

Содержание

Похожие устройства

Скачать