int main(void) { double resist1, resist2; /*抵抗値の入力*/ printf("2つの抵抗値を入力してください. \n"); scanf("%lf%lf", &resist1, &resist2); /*結果の表示*/ printf("直列接続の合成抵抗は%.2f (Ω)\n", calcDirect(resist1, resist2)); printf("並列接続の合成抵抗は%.2f (Ω)です. \n", calcParallel(resist1, resist2)); return 0; }
int main() { adc_init(); init_USART_up(10); // Baud rate is 10 SPI_init(); calibrate_gyro(); // calibrate and initialize ADC uint8_t IR_FRONT_1 = 0x00; uint8_t IR_FRONT_2 = 0x00; while(1){ // usart usart_gogo(); // ad conversion from IR-sensors IRLB = adc_to_cm(adc_read(0)); IRRB = adc_to_cm(adc_read(1)); IRLF = adc_to_cm(adc_read(2)); IRRF = adc_to_cm(adc_read(3)); IRF = adc_to_cm(adc_read(4)); usart_gogo(); MR_Reflex = adc_read(5); reflex_sensor(); calcTokensIR(); calcParallel(); usart_gogo(); if(gyromode == 1){ gyro_gogo(); } } }