void main(void) { /* your definitions here */ char data = 0xaa; char data2 = 0x55; char y; // init buttons and seven-segment displays initIO(); // init LCD initLCD(); lcd_onOff(1, 0); /* your code here */ for (;;) { for (y = 0; y < 8; y++) { printOnLCD(y, 0, 63, data); } wait(1000000l); for (y = 0; y < 8; y++) { printOnLCD(y, 0, 63, data2); } wait(1000000l); } }
/*Called by stationMode(). Enters if not carrying object.*/ void pickUpMode(){ if (itemInHistory() == 1) //checks if mission completed for this station { // Do nothing -> exit code -> leave station mode } else { waitForUserInputStartAbort(); if (pickUpItem == 1) { for (uint8_t cntDigit = 0; cntDigit<12; cntDigit++) //Storing RFID tag in cargo { cargo[cntDigit] = newStream[cntDigit]; } carryItem = 1; // Shows that the robot is carrying an object printOnLCD(1); //Printing cargo RFID tag on display waitForUserInputEndPickup(); // the item has been pickup up and leave stationMode() } else { // Do nothing -> exit code -> leave station mode } } }
/*Called by stationMode(). Enters if carrying object. */ void deliveryMode(){ if (cargoEqualsNewStream() == 1) //Checks if the station is the correct station to leave cargo { for (uint8_t cntDigit = 0; cntDigit < 12; cntDigit++) //Adds the completed station to history { history[historySize][cntDigit] = cargo[cntDigit]; } historySize++; printOnLCD(0); //Prints "No Cargo" on LCD carryItem = 0; //stationDirection = global variabel som beskriver sida om tejp för station. tilldelas egentligen så fort man stött på en station //Skicka kommando till styr-AVR och kalla på dropItem(stationDirection) } else { // Do nothing -> exit code -> leave station mode } }