这篇教程C++ wait_us函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wait_us函数的典型用法代码示例。如果您正苦于以下问题:C++ wait_us函数的具体用法?C++ wait_us怎么用?C++ wait_us使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wait_us函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: sol_pwm/************ Solid PWM ************/void sol_pwm(DigitalOut pwm, int r_turn, int l_turn){ for(i=0; i<10; i++) { pwm = 1; wait_us(r_turn); pwm = 0; wait_ms(26); } for(i=0; i<10; i++) { pwm = 1; wait_us(1525); pwm = 0; wait_ms(26); } for(i=0; i<10; i++) { pwm = 1; wait_us(l_turn); pwm = 0; wait_ms(26); } for(i=0; i<10; i++) { pwm = 1; wait_us(1525); pwm = 0; wait_ms(26); }}
开发者ID:ESE519,项目名称:Project10,代码行数:32,
示例2: liq_pwm/************ Liquid PWM ************/void liq_pwm(DigitalOut pwm, int drop){ for(i=1000; i<drop; i=i+25) { pwm = 1; wait_us(i); pwm = 0; wait_ms(26); } wait(3); for(i=0; i<40; i++) { pwm= 1; wait_us(1300); pwm = 0; wait_ms(26); } wait(3); for(i=1300; i>1000; i=i-25) { pwm= 1; wait_us(i); pwm = 0; wait_ms(26); } wait(7);}
开发者ID:ESE519,项目名称:Project10,代码行数:30,
示例3: reset_rn42void reset_rn42(){ P3OUT &= ~BIT0; wait_us(BLUETOOTH_RESET_HOLD_TIME); P3OUT |= BIT0; wait_us(BLUETOOTH_STARTUP_TIME);}
开发者ID:woelfware,项目名称:BluMote-pod,代码行数:7,
示例4: wait_usvoid VNH5019::clear_fault(){ // if ENDIAG is high, then there is no fault if (ENDIAG.read()) return; // toggle the inputs INA = 0; INB = 0; wait_us(250); INA = 1; INB = 1; wait_us(250); // pull low all inputs and wait 1600us for t_DEL INA = 0; INB = 0; PWM = 0; ENDIAG.output(); ENDIAG = 0; wait_us(1600); // and finally re-enable the motor ENDIAG.input();}
开发者ID:MaximeBonnet27,项目名称:GPSTL-CoupeDeFrance,代码行数:25,
示例5: wait_us// Based on http://arduinodev.woofex.net/2012/12/01/standalone-sharp-dust-sensor/float GP2Y10::read(){ float voMeasured = 0; float calcVoltage = 0; float dustDensity = 0; led = 0; wait_us(SAMPLING_TIME); voMeasured = analog; // read the dust value wait_us(DELTA_TIME); led = 1; // turn the LED off wait_us(SLEEP_TIME); // 0 - 3.3V mapped to 0 - 1023 integer values // recover voltage calcVoltage = voMeasured * 3.3; // linear eqaution taken from http://www.howmuchsnow.com/arduino/airquality/ // Chris Nafis (c) 2012 dustDensity = 0.17 * calcVoltage - 0.1; return dustDensity;}
开发者ID:graymalkin,项目名称:frdm_shed_lights,代码行数:26,
示例6: matrix_scanuint8_t matrix_scan(void){ if (mcp23018_status) { // if there was an error if (++mcp23018_reset_loop == 0) { // since mcp23018_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans // this will be approx bit more frequent than once per second print("trying to reset mcp23018/n"); mcp23018_status = init_mcp23018(); if (mcp23018_status) { print("left side not responding/n"); } else { print("left side attached/n"); frenchdev_blink_all_leds(); } } }#ifdef DEBUG_MATRIX_SCAN_RATE matrix_scan_count++; uint32_t timer_now = timer_read32(); if (TIMER_DIFF_32(timer_now, matrix_timer)>1000) { print("matrix scan frequency: "); pdec(matrix_scan_count); print("/n"); matrix_timer = timer_now; matrix_scan_count = 0; }#endif for (uint8_t i = 0; i < MATRIX_ROWS; i++) { select_row(i); wait_us(30); // without this wait read unstable value. matrix_row_t cols = read_cols(i); if (matrix_debouncing[i] != cols) { matrix_debouncing[i] = cols; if (debouncing) { debug("bounce!: "); debug_hex(debouncing); debug("/n"); } debouncing = DEBOUNCE; } unselect_rows(); } if (debouncing) { if (--debouncing) { wait_us(1); // this should be wait_ms(1) but has been left as-is at EZ's request } else { for (uint8_t i = 0; i < MATRIX_ROWS; i++) { matrix[i] = matrix_debouncing[i]; } } } matrix_scan_quantum(); return 1;}
开发者ID:Xyverz,项目名称:qmk_firmware,代码行数:60,
示例7: mainint main(){ float duration = 0.0; float distance = 0.0; status = false; while(1) { triggerpin = 0; wait_us(1); // Wait for 1us for clean low pulse triggerpin = 1; wait_us(10); // Trigger Pulse of 10us triggerpin = 0; while(!echopin); //Poll echo pin for High timer.start(); //start Timer while(echopin); //Poll echo pin for low timer.stop(); //Stop timer duration = (float)(timer.read_us()); //Read Timer Value = Echo High Time //terminal.printf("/n Timer Reading cm : %f /n", duration); distance = cal_distance(duration); terminal.printf("/n Object Distance cm : %f /n", distance); timer.reset(); //Reset Timer wait(1); // Repeat Trigger after 1sec }}
开发者ID:abhitrip,项目名称:Robotic-Systems,代码行数:30,
|