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 } }
void InitAll() { // int i; // uint8 buffer_in[16]={0}; //uint8 buffer_out[16]={0}; CONSOLE_USART_INIT(); console_send("\r\n Motors device start\r"); LED_INIT(); I2C_INIT(); ReadConfig(); /* #ifdef EEPROM if (ReadConfig()==TRUE) console_send("\nEEPROM start\r"); else { console_send("\nEEPROM is not connect \r\n parameters is enabled by default\r"); SettingsDefault(); } #else SettingsDefault(); CheckAndWriteVersion(); PrintVersion(bufer_cons_out); console_send(bufer_cons_out); #endif */ (SysTick_Config(SystemCoreClock / 16)); motorInitTimer(); motorInitGpio(); motorInit(); motorTest(); motorSettings(); WIZ_GPIO_Install(); WIZ_Config(); console_send("\nWIZNET start\r\n>"); }
void enterTest(SmartCar * smartCar, uint8_t menu) { switch (menu) { case 1: // segment & barLED segmentTest(smartCar); break; case 2: // servo servoTest(smartCar); break; case 3: // motor & encoder motorTest(smartCar); break; case 4: // camera cameraTest(smartCar); break; } }
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 } }