hmc5883l
Dependencies: HMC5883L LCD4884 MFRC522 eeprom mbed
Diff: project.cpp
- Revision:
- 10:7475e737bc0f
- Parent:
- 9:b83b9198988d
- Child:
- 11:d55f0cc16089
diff -r b83b9198988d -r 7475e737bc0f project.cpp --- a/project.cpp Tue Dec 08 22:22:37 2015 +0000 +++ b/project.cpp Wed Dec 09 02:29:26 2015 +0000 @@ -28,7 +28,7 @@ DigitalOut m1inA1(PB_13); //Motor 1 DigitalOut m1inA2(PB_14); DigitalOut m1inB1(PB_15); -DigitalOut m1inB2(PB_1); +DigitalOut m1inB2(PB_12); DigitalOut m2inA1(PB_5); //Motor 2 DigitalOut m2inA2(A5); DigitalOut m2inB1(A4); @@ -46,7 +46,7 @@ m1inA2 = 1; m1inB1 = 1; m1inB2 = 0; - wait_ms(50); + wait_ms(25); } void m1step2() { @@ -54,7 +54,7 @@ m1inA2 = 1; m1inB1 = 0; m1inB2 = 1; - wait_ms(50); + wait_ms(25); } void m1step3() { @@ -62,7 +62,7 @@ m1inA2 = 0; m1inB1 = 0; m1inB2 = 1; - wait_ms(50); + wait_ms(25); } void m1step4() { @@ -70,7 +70,7 @@ m1inA2 = 0; m1inB1 = 1; m1inB2 = 0; - wait_ms(50); + wait_ms(25); } void m1stopMotor() { @@ -409,7 +409,7 @@ float x,y; x = X.read()*360; y = Y.read()*360; - printf("X = %f.2\tY = %f.2\n",x,y); + // printf("X = %f.2\tY = %f.2\n",x,y); if(x > 200) { Up(); } @@ -471,7 +471,7 @@ { for(int c=0; c<9; c++) { printf("%d ",data[c]); - // if((c+1)%3==0){printf("||");} + if((c+1)%3==0){printf("||");} } printf("\n"); } @@ -512,6 +512,14 @@ compass1.init(); compass2.init(); compass3.init(); + + while(1){ + read(data); + dataprint(data); + wait(0.5); + + } + string NameJune="Natthanicha",recieveNameJune,SurJune="Jamroonpan",recieveSurJune,IdJune="57340500023",recieveIdJune; //June start @ 1-36 string NameO="Sirawat",recieveNameO,SurO="Sok",recieveSurO,IdO="57340500071",recieveIdO; uint8_t UID[8],recieveUID[8]; @@ -557,6 +565,7 @@ lcd.backlight(ON); wait(2); lcd.LCD_clear(); + // servodown(); while(1) { lcd.LCD_write_string(0,0,"SCAN ID CARD",0); if ( ! RFID.PICC_IsNewCardPresent()) // Look for new cards @@ -627,13 +636,16 @@ while(1) { // control(); + read(data); + wait(0.5); + dataprint(data); if(Switch2.read()==1) { char str[12]; mode=1; servodown();//servo down read(data); dataprint(data); - wait_ms(500); + // wait_ms(500); servoup();//servo up point = checkpoint(); sprintf(str,"point = %d",point); @@ -677,7 +689,7 @@ } - printf("mode=%d\n",mode); + // printf("mode=%d\n",mode); } //end while mode loop }