You are on page 1of 2

// USBtest.cpp: archivo de proyecto principal. #include <stdafx.h> #using "USBio.dll" #include <iostream> #include <Windows.h> #include <stdio.

h> #include <conio.h> using namespace System; using namespace std; void main(void) { USBio MiUSB;

//creamos objeto USB

int BitB, Val, m, n, s, t, x=0;

cout<<("Selecciona la opcion deseda:\n"); cout<<"\na. leer valor analogico(potenciometro)\n"<<endl; cout<<"b. leer valor digital(dip switch)\n"<<endl; cout<<"c. escribir byte analogico\n"<<endl; cout<<"d. escribir byte digital puerto B(leds)\n"<<endl; cout<<"e. escribir el numero de bite puerto B(leds)\n"<<endl; cout<<"f. lee el numero de bite puerto D (dip switch)\n"<<endl; for(x=0;x<=50;x++) { m=getchar(); switch(m) { case 'a': Val = MiUSB.LeeValAnalogico( ); cout<<"\n el valor es:"<<Val<<endl; getch(); break; case 'b': BitB = MiUSB.LeeBytePD(); cout<<"\n el valor es:"<<BitB<<endl; getch(); break; case 'c': cout<<"selecciona num de 0 a 255\n"; cin>>s; MiUSB.EscValAnalogico(s); cout<<"el valor se ha escrito\n"; getch(); MiUSB.EscValAnalogico(0); break; case 'd': cout<<"selecciona num de 0 a 255\n"; cin>>s; MiUSB.EscBytePB(s); cout<<"el valor se ha escrito\n"; getch(); MiUSB.EscBytePB(0); break;

case 'e': cout<<"selecciona num de bit para escribir\n"; cin>>s; cout<<"selecciona num el valor que quieres escribir(0,1)\n"; cin>>t; MiUSB.EscBitPB( s, t); cout<<"el valor se ha escrito\n"; getch(); break; case 'f': cout<<"selecciona num de bit para leer\n"; cin>>s; Val=MiUSB.LeeBitPD( s ); cout<<"\n el valor es:"<<Val<<endl; getch(); break; } } cin.ignore(); return; }

You might also like