Don't ad-block us - support your favorite websites. We have safe, unobstrusive, robotics related ads that you actually want to see - see here for more.
0 Members and 1 Guest are viewing this topic.
#include "hardware.h"// Initialise the hardwarevoid appInitHardware(void) { initHardware();}// Initialise the softwareTICK_COUNT appInitSoftware(TICK_COUNT loopStart){// -------- Start Sparkfun serLCD------- //turn on LCDpin_high(LCD_Relay); delay_ms(300); rprintfInit( displayGetWriter(&LCD)); displayBacklight(&LCD,TRUE); // -------- End Sparkfun serLCD------- return 0;}// This is the main loopTICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart) {//////////Main Loop/////////////////////////////////////////char tagString[13];int index=0;boolean reading = false;//read from rfidwhile(uartGetByte(ID20)!=-1){//do while data recieved non -1 dataint readByte=uartGetByte(ID20);//Assign byte read to a temp intif(readByte == 2) reading = true; //begining of tag if(readByte == 3) reading = false; //end of tag if(reading && readByte != 2 && readByte != 10 && readByte != 13){//store the tag tagString[index] = readByte; index ++; }}//display datafor (int i=0;i<12;i++){//display data along collumnsdisplayGoto(&LCD,i,0);//display positionrprintf("%c",tagString[i]);}//clear screendelay_ms(1000);displayClear(&LCD); return 0; }
void loop(){ char tagString[13]; int index = 0; boolean reading = false; while(Serial.available()){ int readByte = Serial.read(); //read next available byte if(readByte == 2) reading = true; //begining of tag if(readByte == 3) reading = false; //end of tag if(reading && readByte != 2 && readByte != 10 && readByte != 13){ //store the tag tagString[index] = readByte; index ++; } } checkTag(tagString); //Check if it is a match clearTag(tagString); //Clear the char of all value resetReader(); //eset the RFID reader}
while(readByte != 13){ if(uartGetByte(ID20)!=-1) { //your other if statements here }
//read from rfidwhile(uartGetByte(ID20)!=-1){//do while data recieved non -1 data int readByte=uartGetByte(ID20);//Assign byte read to a temp int
int readByte;while (readByte = uartGetByte(ID20), readByte !=-1){ // You've now got the data in readByte}
Started by gamefreak « 1 2 » Mechanics and Construction
Started by Admin Electronics
Started by ledrac Electronics
Started by roborg Electronics