cleanup
This commit is contained in:
parent
15f06eee66
commit
4a8aad0d7f
29
NFC.c
29
NFC.c
@ -16,27 +16,24 @@ void NFCInit(){
|
||||
|
||||
//NFCNummer return serienummer van de NFC-tag
|
||||
uchar NFCAvailable(){ //is er een kaart en is het leesbaar? serienummer
|
||||
uchar str[5];
|
||||
uchar str[5], Colour, Direction;
|
||||
if(RC522_request(PICC_REQALL, str) == MI_OK){
|
||||
if(RC522_anticoll(str) == MI_OK){ // controleert of de kaart reageert
|
||||
/* Select card to be active */
|
||||
uchar l = RC522_selectTag(str);
|
||||
uchar Colour = NFCRead (0 , 1 , 0 , str);
|
||||
uchar Direction = NFCRead (2 , 0 , 9 , str);
|
||||
RC522_selectTag(str);
|
||||
Colour = NFCRead (0 , 1 , 0 , str);
|
||||
Direction = NFCRead (2 , 0 , 9 , str);
|
||||
RGBLed_update (Colour);
|
||||
|
||||
switch (Direction){
|
||||
case 'S':
|
||||
return 0b00; // stop = 00
|
||||
case 'D':
|
||||
return 0b11; // vooruit = 11
|
||||
case 'L':
|
||||
return 0b10; // 10= Links
|
||||
case 'R':
|
||||
return 0b01; // 01 = rechts
|
||||
|
||||
|
||||
case 'S':
|
||||
return 0b00; // stop = 00
|
||||
case 'D':
|
||||
return 0b11; // vooruit = 11
|
||||
case 'L':
|
||||
return 0b10; // 10= Links
|
||||
case 'R':
|
||||
return 0b01; // 01 = rechts
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user