Show Posts
|
|
Pages: [1] 2 3
|
|
1
|
Using Arduino / Programming Questions / Serial data at 57600
|
on: March 31, 2013, 12:48:12 am
|
I am trying read data at 57600 baud, I want to read serial data until read a null character.. and separate it my tag is (HEX): 9062FD59, At the moment just I can read on serial monitor: FFFFFF90 0 0 0 FFFFFF90 62 0 0 FFFFFF90 62 FFFFFFFD 0 FFFFFF90 62 FFFFFFFD 59 char code[20];
int val = 0; int bytesread = 0; int i = 0;
void setup(){ Serial.begin(57600); }
void loop() { if (Serial.available() > 0 ) bytesread = 0; while(bytesread < 6) { if (Serial.available() > 0) { val = Serial.read(); code[i] = val; i++; if (code[i]= '\0'); { break; } } //dont use here } Serial.println(code[0], HEX); Serial.println(code[1], HEX); Serial.println(code[2], HEX); Serial.println(code[3], HEX); } my reader is connected to Max232 and from it to Rx ArduinoUno, and I have ground commun the reader r10 works fine connect to max323 and direct to PC using converser serial-usb reader Iclass https://www.hidglobal.com/products/readers/iclass/r10
|
|
|
|
|
4
|
Using Arduino / Programming Questions / Re: RFID programming issues
|
on: March 29, 2013, 07:27:13 am
|
|
How have you connected your ID20 to Arduino? -check grounds -check your baudrate
I have tried your code (whit my tag) and on serial monitor I can see RFID Reader Initialized Tag read: 2400CC392A Checksum: FB -- passed. VALUE: 2400CC392A Tag not authorized
|
|
|
|
|
6
|
Using Arduino / Programming Questions / Save and read string RFID in EEPROM-ArduninoUNO (solved)
|
on: March 29, 2013, 03:01:15 am
|
Hello everyone and so sorry to the moderators for repeat my question.. I have a RFID-ID20 + ArduinoUNO I want to read a tag and save it in EEPROM (between 10 to 29) read a second tag and save it in EEPROM (between 30 to 49) when my code read a tag saved before in EEPROM must delete this tag only between positions where this tag had been saved before currently -if read a tag that before was saved between 30 to 49 my code work fine. my problem: - if read a tag that before was saved between 10 to 29 my code delete the EEPROM between 10 to 49, here must delete only between 10 to 29 #include <EEPROM.h>
char code[15];
int val = 0; int bytesread = 0; int led = 13; int addr = 10; int addr2 = 30;
byte x= 1; // (00000001)
void setup() { Serial.begin(9600); pinMode(13, OUTPUT); pinMode(12, OUTPUT); }
void loop() { if(Serial.available() > 0) { if((val = Serial.read()) == 10) { bytesread = 0; while(bytesread < 15) { if( Serial.available() > 0) { val = Serial.read(); if((val == 10)||(val == 15)) { break; } code[bytesread] = val; bytesread++; } } Serial.print("tag read: "); Serial.println(code); //tag1 x2400CC392AFBxxx tag2 x2400CC572897xxx
bool match1 = true; byte offs1=10; bool match2 = true; byte offs2=30; //comparation1 value in eeprom with value read-tag for (byte b=2; b<13; b++) { if (EEPROM.read( b + offs1) != code [b]) { match1 = false; break; } } if (match1 == true) { Serial.println("ok position1 - tag deleted from position1, EERPOM 10 to 29"); digitalWrite(13, HIGH); delay(250); digitalWrite(13, LOW); delay(250); bitWrite(x, 1, 0); //delete EEPROM between 10 to 29 for (int i = 10; i < 29; i++) EEPROM.write(i, 0); } else //comparation2 value in eeprom with value read-tag for (byte b=2; b<13; b++) { if (EEPROM.read( b + offs2) != code [b]) { match2 = false; break; } } if (match2 == true) { Serial.println("ok position2 - tag deleted from position2, EERPOM 30 to 49"); digitalWrite(12, HIGH); delay(250); digitalWrite(12, LOW); delay(250); bitWrite(x, 2, 0); //delete EEPROM between positions 30 to 49 for (int i = 30; i < 49; i++) EEPROM.write(i, 0); } else //bitread position 1 if (bitRead(x,1) == 0) { //write 1 bitWrite(x, 1, 1); //write in eerpom for(byte b=0; b<bytesread; b++) { //addr = start in position 10 EEPROM.write(addr + b, code[b]); } //turn on led pin13 digitalWrite(13, HIGH); delay(250); digitalWrite(13, LOW); delay(250); Serial.println("1 at position 1 of X - Tag saved at position1, 10 to 24 in EEPROM"); } else //bitread position 2 if (bitRead(x,2) == 0) { //write 1 bitWrite(x, 2, 1); //write in eerpom for(byte b=0; b<bytesread; b++) { //addr2 = start in position 30 EEPROM.write(addr2 + b, code[b]); } //turn on led pin12 digitalWrite(12, HIGH); delay(250); digitalWrite(12, LOW); delay(250); Serial.println("1 at position 2 of X - Tag saved at position2, 30 to 44 in EEPROM"); } } } }
Thanks for any help
|
|
|
|
|
7
|
Using Arduino / Programming Questions / Re: Write in the eerpom of ArduinoUno a code RFID (ID20)
|
on: March 24, 2013, 07:37:56 am
|
thanks, and yes, I have done it Serial.println I have attached a pic, because my problem is just when read a tag saved before in position 10 to 24 of the EEPROM, here delete the EEPROM between 10 to 44 but must delete only 10 to 24 if tag read is saved between 10 to 24 in the EEPROM must delete it for (int i = 10; i < 29; i++) //Iam using 10 to 29 or 10 to 24 any is fine EEPROM.write(i, 0); if tag read is saved between 30 to 44 in the EEPROM must delete it for (int i = 30; i < 49; i++) //Iam using 30 to 49 or 30 to 44 any is fine EEPROM.write(i, 0); when it read a tag saved in eeprom in position between 30 to 44 is fine because just delete 30 to 44 and dont delete 10 to 24 then I have a problem around here //comparation value in eeprom with value read-tag bool match1 = true; byte offs1=10; bool match2 = true; byte offs2=30;
for (byte b=2; b<13; b++) { if (EEPROM.read( b + offs1) != code [b]) { match1 = false; break; } } if (match1 == true) { Serial.println("ok position1 - tag deleted from position1, EERPOM 10 to 29"); digitalWrite(13, HIGH); delay(250); digitalWrite(13, LOW); delay(250); bitWrite(x, 1, 0); //clean EEPROM 10 to 29 for (int i = 10; i < 29; i++) EEPROM.write(i, 0); } else //comparation value in eeprom with value read-tag
for (byte b=2; b<13; b++) { if (EEPROM.read( b + offs2) != code [b]) { match2 = false; break; } } if (match2 == true) { Serial.println("ok position2 - tag deleted from position2, EERPOM 30 to 49"); digitalWrite(12, HIGH); delay(250); digitalWrite(12, LOW); delay(250); bitWrite(x, 2, 0); //clean EEPROM 30 to 49 for (int i = 30; i < 49; i++) EEPROM.write(i, 0); } thanks for any help
|
|
|
|
|
8
|
Using Arduino / Programming Questions / Re: Write in the eerpom of ArduinoUno a code RFID (ID20)
|
on: March 24, 2013, 04:49:28 am
|
Hello, thanks everyone for help me.. it's a resume: I have an ArduinoUno + ID20 and I am trying: - Turn on a led(pulse-pin13) when a tag1 is read and then save it in EEPROM in position 10 to 29 (it is ok  ) - when a second tag2 is read save it in EEPROM in position 30 to 49 and pulse pin12 (it is ok  ) - when the tag read is already saved before is EEPROM delete it from position (10 to 29 or 30 to 49) and give a pulse (pin12 or pin13) (it is my problem  ) for example if tag1 is saved in position 10 to 29 and when this tag is read again my code must delete the EEPPROM just between 10 to 29, but at the moment my code delete the EEPROM between 10 to 49, it isn't correct  #include <EEPROM.h>
char code[15];
int val = 0; int bytesread = 0; int led = 13; int addr = 10; int addr2 = 30;
byte x= 1; // (00000001)
void setup() { Serial.begin(9600); pinMode(13, OUTPUT); pinMode(12, OUTPUT); }
void loop() { if(Serial.available() > 0) { if((val = Serial.read()) == 10) { bytesread = 0; while(bytesread < 15) { if( Serial.available() > 0) { val = Serial.read(); if((val == 10)||(val == 15)) { break; } code[bytesread] = val; bytesread++; } } Serial.print("tag read: "); Serial.println(code); //tag1 x2400CC392AFBxxx tag2 x2400CC572897xxx
//comparation value in eeprom with value read-tag bool match1 = true; byte offs1=10; bool match2 = true; byte offs2=30;
for (byte b=2; b<13; b++) { if (EEPROM.read( b + offs1) != code [b]) { match1 = false; break; } } if (match1 == true) { Serial.println("ok position1 - tag deleted from position1, EERPOM 10 to 29"); digitalWrite(13, HIGH); delay(250); digitalWrite(13, LOW); delay(250); bitWrite(x, 1, 0); //clean EEPROM 10 to 29 for (int i = 10; i < 29; i++) EEPROM.write(i, 0); } else //comparation value in eeprom with value read-tag
for (byte b=2; b<13; b++) { if (EEPROM.read( b + offs2) != code [b]) { match2 = false; break; } } if (match2 == true) { Serial.println("ok position2 - tag deleted from position2, EERPOM 30 to 49"); digitalWrite(12, HIGH); delay(250); digitalWrite(12, LOW); delay(250); bitWrite(x, 2, 0); //clean EEPROM 30 to 49 for (int i = 30; i < 49; i++) EEPROM.write(i, 0); } else //bitread position 1 if (bitRead(x,1) == 0) { //write 1 bitWrite(x, 1, 1); //write in eerpom for(byte b=0; b<bytesread; b++) { //addr = start in position 10 EEPROM.write(addr + b, code[b]); } //turn on led pin13 digitalWrite(13, HIGH); delay(250); digitalWrite(13, LOW); delay(250); Serial.println("1 at position 1 of X - Tag saved at position1, 10 to 24 in EEPROM"); } //bitread position 2 else if (bitRead(x,2) == 0) { //write 1 bitWrite(x, 2, 1); //write in eerpom for(byte b=0; b<bytesread; b++) { //addr2 = start in position 30 EEPROM.write(addr2 + b, code[b]); } //turn on led pin12 digitalWrite(12, HIGH); delay(250); digitalWrite(12, LOW); delay(250); Serial.println("1 at position 2 of X - Tag saved at position2, 30 to 44 in EEPROM"); } } } }
|
|
|
|
|
11
|
Using Arduino / Programming Questions / Re: Write in the eerpom of ArduinoUno a code RFID (ID20)
|
on: March 23, 2013, 12:21:37 am
|
Hello everyone again  finally my code is working fine, but just for one card..  if I am using a second card it work so so.. - after cleaned my EEPROM I have programming my Arduino. Then: - start-> read a tag1 -> save it in EEPROM (position1, 10 to 24 in EEPROM) - when read a second tag2-> save it in EEPROM (position2, 30 to 44 in EEPROM) - but when it has read a tag saved before in position 10 to 24 in EEPROM, my code clean the EEPROM from 10 to 44, but here my code must clean just between 10 to 24 //ArduinoUNO //code_test_7.5.4
#include <EEPROM.h>
char code[15]; char valor[12];
int val = 0; byte value1; byte value2;
int bytesread = 0; int led = 13;
int addr = 10; int addr2 = 30; int a = 0; byte x= 1; // (00000001)
void setup() { Serial.begin(9600); pinMode(13, OUTPUT); pinMode(12, OUTPUT); }
void loop() { if(Serial.available() > 0) { if((val = Serial.read()) == 10) { bytesread = 0; while(bytesread < 15) { if( Serial.available() > 0) { val = Serial.read(); if((val == 10)||(val == 15)) { break; } code[bytesread] = val; bytesread++; } } Serial.print("tag read: "); Serial.println(code); //tag1 x2400CC392AFBxxx tag2 x2400CC572897xxx
Serial.print(" bitRead: "); //test read bit to bit (00000001) Serial.print(bitRead(x,7)); Serial.print(bitRead(x,6)); Serial.print(bitRead(x,5)); Serial.print(bitRead(x,4)); Serial.print(bitRead(x,3)); Serial.print(bitRead(x,2)); Serial.print(bitRead(x,1)); Serial.println(bitRead(x,0));
//test read eeprom 10 to 49 Serial.print("EEPROM desde 10 to 49: "); for (int k=10; k<49; k++) { value1 = EEPROM.read(k); Serial.print(value1); } Serial.println(" "); //comparation value in eeprom with value read tag bool match1 = true; byte offs1=10; bool match2 = true; byte offs2=30;
for (byte b=2; b<13; b++) { if (EEPROM.read( b + offs1) != code [b]) { match1 = false; break; } } if (match1 == true) { Serial.println("ok position1 - tag deleted from position1, EERPOM 10 to 29"); digitalWrite(13, HIGH); delay(250); digitalWrite(13, LOW); delay(250); bitWrite(x, 1, 0); //clean EEPROM 10 to 29 for (int i = 10; i < 29; i++) EEPROM.write(i, 0); } else //comparation value in eeprom with value read tag
for (byte b=2; b<13; b++) { if (EEPROM.read( b + offs2) != code [b]) { match2 = false; break; } } if (match2 == true) { Serial.println("ok position2 - tag deleted from position2, EERPOM 30 to 49"); digitalWrite(12, HIGH); delay(250); digitalWrite(12, LOW); delay(250); bitWrite(x, 2, 0); //clean EEPROM 30 to 49 for (int i = 30; i < 49; i++) EEPROM.write(i, 0); } else //bitread position 1 if (bitRead(x,1) == 0) { //write 1 bitWrite(x, 1, 1); //write in eerpom for(byte b=0; b<bytesread; b++) { //addr = star in position 10 EEPROM.write(addr + b, code[b]); } //turn on led pin13 digitalWrite(13, HIGH); delay(250); digitalWrite(13, LOW); delay(250); Serial.println("1 at position 1 of X - Tag saved at position1, 10 to 24 in EEPROM"); } //bitread position 2 else if (bitRead(x,2) == 0) { //write 1 bitWrite(x, 2, 1); //write in eerpom for(byte b=0; b<bytesread; b++) { //addr2 = star in position 30 EEPROM.write(addr2 + b, code[b]); } //turn on led pin12 digitalWrite(12, HIGH); delay(250); digitalWrite(12, LOW); delay(250); Serial.println("1 at position 2 of X - Tag saved at position2, 30 to 44 in EEPROM"); } //test read bit to bit (00000001) Serial.print(" bitRead: "); Serial.print(bitRead(x,7)); Serial.print(bitRead(x,6)); Serial.print(bitRead(x,5)); Serial.print(bitRead(x,4)); Serial.print(bitRead(x,3)); Serial.print(bitRead(x,2)); Serial.print(bitRead(x,1)); Serial.println(bitRead(x,0)); //test read EEPROM Serial.print("EEPROM desde 0 to 44: "); for (int k=0; k<44; k++) { Serial.print(EEPROM.read(k)); } Serial.println(" "); Serial.println("__________________________"); } } }
|
|
|
|
|
14
|
International / Proyectos / Re: Apoyo a Educación (Matématica - Física- Química - Artes....)
|
on: March 17, 2013, 05:15:50 am
|
hola.. ..primero no logré encontrar el artículo/noticia donde un profesor Chileno en Santiago dicta clases de matemáticas en un vivero.. y además la producción de ese vivero se vende según temporada.. copiando aquella idea de aquel profesor, un vivero da para muchas asignaturas.. Lenguaje (ej.: reportes), Física (ej.: temperaturas), matemáticas (ej.: calcular áreas), tecnología (ej.: sensores), Química(aquí no me manejo  ) artes?? bueno ya se verá como introducir aquello, pero si.. creo que un vivero podría ser el camino.. además de el trabajo colabarativo y el manejo de finanzas.. desde la web del mineduc es posible bajar los programas y desde allí obtener las recomendaciones o tematicas de cada asignatura y cada curso..
|
|
|
|
|