void test() { unsigned char button; clear(); delay(200); print("Orangutn"); // print to the top line of the LCD delay_ms(400); // delay 200 ms lcd_goto_xy(0, 1); // go to the start of the second LCD line #if defined __AVR_ATmega328P__ print(" LV-328"); // print to the bottom line of the LCD #elif defined __AVR_ATmega168__ print(" LV-168"); // print to the bottom line of the LCD #else #error "Unrecognized device type" #endif delay_ms(1000); // delay 700 ms clear(); // clear the LCD, move cursor to start of top line print(" Temp."); do { // Perform 10-bit analog-to-digital conversions on ADC channel 6. // Average ten readings and return the result, which will be one // third of the battery voltage when the "ADC6 = VBAT/3" solder // bridge is in place on the bottom of the Orangutan PCB int Tf = read_temperature_f(); // read temp sensor on ADC6 in 0.1°F lcd_goto_xy(1, 1); // second character of the second LCD line print_long(Tf/10); // display temperature in °F print("."); // print the decimal point print_long(Tf - 10*(Tf/10)); // display the tenths digit print_character(223); // display the degree symbol character (°) print("F "); // display the units delay_ms(50); // delay for 50 ms button = button_is_pressed(ALL_BUTTONS); // check for button press } while (button == 0); // loop if no buttons are being pressed // *** MAIN LOOP *** while (1) // loop forever { if (button & TOP_BUTTON) // if the top button is pressed button = melodyTest(); // this func. loops until next button press else if (button & MIDDLE_BUTTON) // if the middle button is pressed button = IOTest(); // this func. loops until next button press else if (button & BOTTOM_BUTTON) // if the bottom button is pressed button = motorTest(); // this func. loops until next button press } }
void test() { unsigned char button; clear(); delay(200); print("Orangutn"); // print to the top line of the LCD delay_ms(400); // delay 200 ms lcd_goto_xy(0, 1); // go to the start of the second LCD line #if defined __AVR_ATmega328P__ print(" SV-328"); // print to the bottom line of the LCD #elif defined __AVR_ATmega168__ print(" SV-168"); // print to the bottom line of the LCD #else #error "Unrecognized device type" #endif delay_ms(1000); // delay 700 ms clear(); // clear the LCD, move cursor to start of top line print(" VBAT"); do { // Perform 10-bit analog-to-digital conversions on ADC channel 6. // Average ten readings and return the result, which will be one // third of the battery voltage when the "ADC6 = VBAT/3" solder // bridge is in place on the bottom of the Orangutan PCB int vbat = analog_read_average(6, 10); // 10-sample avg of ADC6 vbat = to_millivolts(vbat) * 3; // convert reading to bat. voltage (mV) lcd_goto_xy(0, 1); // go to the start of the second LCD line print_long(vbat); // display battery voltage in millivolts print(" mV "); // display the units delay_ms(50); // delay for 50 ms button = button_is_pressed(ANY_BUTTON); // check for button press } while (button == 0); // loop if no buttons are being pressed // *** MAIN LOOP *** while (1) // loop forever { if (button & TOP_BUTTON) // if the top button is pressed button = melodyTest(); // this func. loops until next button press else if (button & MIDDLE_BUTTON) // if the middle button is pressed button = IOTest(); // this func. loops until next button press else if (button & BOTTOM_BUTTON) // if the bottom button is pressed button = motorTest(); // this func. loops until next button press } }
int main(void) { mcu_init(); IOTest(); udb_init(); #if (BOARD_TYPE != AUAV3_BOARD) udb_eeprom_init(); // using legacy eeprom driver #endif while (1) { udb_run(); } return 0; }
int main(void) { mcu_init(); IOTest(); udb_init(); #if (BOARD_TYPE != AUAV3_BOARD) udb_eeprom_init(); // using legacy eeprom driver #endif DPRINT("MatrixPilot LedTest\r\n"); while (1) { udb_run(); } return 0; }
void test() { unsigned char button; clear(); delay(200); print("Orangutan"); // print to the top line of the LCD delay_ms(400); // delay 200 ms lcd_goto_xy(0, 1); // go to the start of the second LCD line print(" X2"); // print to the bottom line of the LCD red_led(1); delay_ms(100); green_led(1); delay_ms(100); red_led2(1); delay_ms(100); green_led2(1); delay_ms(100); yellow_led(1); delay_ms(100); red_led(0); delay_ms(100); green_led(0); delay_ms(100); red_led2(0); delay_ms(100); green_led2(0); delay_ms(100); yellow_led(0); delay_ms(100); clear(); // clear the LCD, move cursor to start of top line print(" VBAT"); do { // Perform 10-bit analog-to-digital conversions on ADC channel 6. // Average ten readings and return the result, which will be one // third of the battery voltage when the "ADC6 = VBAT/3" solder // bridge is in place on the bottom of the Orangutan PCB int vbat = read_battery_millivolts_x2(); lcd_goto_xy(0, 1); // go to the start of the second LCD line print_long(vbat); // display battery voltage in millivolts print(" mV "); // display the units delay_ms(50); // delay for 50 ms button = button_is_pressed(ANY_BUTTON); // check for button press } while (button == 0); // loop if no buttons are being pressed red_led(1); green_led(1); red_led2(1); green_led2(1); yellow_led(1); // *** MAIN LOOP *** while (1) // loop forever { if (button & TOP_BUTTON) // if the top button is pressed button = melodyTest(); // this func. loops until next button press else if (button & MIDDLE_BUTTON) // if the middle button is pressed button = IOTest(); // this func. loops until next button press else if (button & BOTTOM_BUTTON) // if the bottom button is pressed button = motorTest(); // this func. loops until next button press } }