#include <sys/stat.h>
#include <sys/select.h>
#include <sys/time.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "acr120.h"
#define STX 0x2
#define ETX 0x3
#define sid 0x1
unsigned char cmd[8], ans[6], val, check = 0;
size_t bytes = 0;
int fd,ret;
//unsigned int val;
unsigned int u[4];
unsigned int man,men;
unsigned char id;
unsigned char key[]={0XFF,0XFF,0XFF,0XFF,0XFF,0XFF};
unsigned char data;
unsigned int valo=78;
int main(){
//static const char const *acr120_error[]={};
//acr120_reset(fd, 1, 1,500);
//while(1){
fd=acr120_open ("/dev/ttyUSB0", 1, 38400);
//acr120_power_off(fd, 1, 500);
//acr120_power_on(fd, 1, 1500);
acr120_select(fd,1,&man,5000);
//acr120_get_id(fd,&id, 500);
acr120_login(fd, 1,1,MIFARE_KEY_AA,key, 500);
//usleep(20000);
//acr120_write_value(fd,1, 4,valo, 500);
//acr120_read_block(fd,1, 01,
// &data,5000);
acr120_read_value(fd,1,4,&men, 500);
//printf("coba= %i\n",coba);
//acr120_write_value(fd, 1, 01, 123, 500);
//acr120_write_block(fd,1, 01, id, 500);
//acr120_write_register (fd, 1, ACR120_REGISTER_BUZZER , 20, 250);
//printf("%d\n",&val);
//nibble2dec(unsigned int *val, unsigned char *nibble);
//printf("acr120_errno = %d\n",acr120_errno);
printf("acr120_strerror = %s\n",acr120_strerror());
//usleep(2000);
//}
}
/*gcc man.c acr120.c -o man */
Tidak ada komentar:
Posting Komentar