int main(void) { // packets[0] = UPC-A Barcode // packets[1] = Item Name // packets[2] = Number of Servings // packets[3] = Scan Date (MM/DD/YYYY); char** packets; char return_key; char package[] = "<keypad><x>*/"; TRISGbits.TRISG7 = 1; //in breakout pin RF2 (row 1) TRISGbits.TRISG2 = 1; //in breakout pin RA2 (row 2) TRISCbits.TRISC0 = 1; //in breakout pin RB8 (row 3) TRISCbits.TRISC1 = 1;//in breakout pin RB9 (row 4) TRISEbits.TRISE12 = 0; //in breakout pin RB12 (col 1) TRISCbits.TRISC2 = 0; //in breakout pin RB10 (col 2) TRISEbits.TRISE14 = 0; //in breakout pin RB14 (col 3) ANSELGbits.ANSG7 = 0; //Row 1-4 //configuring all pins as digital ANSELGbits.ANSG2 = 0; ANSELCbits.ANSC0 = 0; ANSELCbits.ANSC1 = 0; ANSELEbits.ANSE12 = 0; //Col 1-3 ANSELCbits.ANSC2 = 0; ANSELEbits.ANSE14 = 0; InitClock(); InitUART2(); /* Infinite Loop */ while ( TRUE ) { if (rx_complete) { break; } return_key = 'X'; //initialize return key to default return variable from readKeyboard() while(return_key == 'X'){ //while nothing is pressed, keep on making calls return_key = readKeyboard(); } if(return_key != 'X'){ //if return_key is not default key, send to RPi package[9] = return_key; U1MODEbits.UARTEN = 1; // Re-enable UART if not already done printf("%s", package); } while(readKeyboard() != 'X'){ //no operation till next key is pressed. } } packets = get_barcode(); read_sd_card(packets); }
int main( int, char** ) { std::ifstream input_file( "../file_io/file.txt" ); if( input_file.is_open() ) { std::string input_line; while( getline( input_file, input_line) ) { std::vector< std::string > strings; std::split( input_line, ' ', strings ); std::cout << "Price: " << get_price( input_line ) << " " << "Barcode: " << get_barcode( input_line ) << std::endl; } input_file.close(); } return 0; }