这篇教程C++ ADC_Conversion函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ADC_Conversion函数的典型用法代码示例。如果您正苦于以下问题:C++ ADC_Conversion函数的具体用法?C++ ADC_Conversion怎么用?C++ ADC_Conversion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ADC_Conversion函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: read_sensors/** Reads all relevant sensor values and stores it in appropriate global variables.*/void read_sensors(){ Left_white_line = ADC_Conversion(LEFT_SENSOR); Center_white_line = ADC_Conversion(CENTER_SENSOR); Right_white_line = ADC_Conversion(RIGHT_SENSOR); Front_IR_Sensor = ADC_Conversion(FRONT_IR_SENSOR);}
开发者ID:pararthshah,项目名称:android_interface_firebird_api_group2_cs308_2012,代码行数:10,
示例2: arenaLeft_2void arenaLeft_2(){ nodeMissEnable = 0;/* stop(); _delay_ms(1000); soft_left(); _delay_ms(1000);*/ velocity(forwardLeftSpeed, forwardRightSpeed); left(); _delay_ms(1000); centre = ADC_Conversion(2); while(centre < 15) { centre = ADC_Conversion(2); } stop(); _delay_ms(100); nodeMissEnable = 1;}
开发者ID:kdsouza1496,项目名称:Cargo-alignment-robot,代码行数:27,
示例3: getValue1 int getValue1(void){ centre = ADC_Conversion(2); sensorLeft = ADC_Conversion(3); sensorRight = ADC_Conversion(1);}
开发者ID:kdsouza1496,项目名称:Cargo-alignment-robot,代码行数:7,
示例4: set_color//++++++===Servo __init__ ========++++++++void set_color(){ Left_white_line = ADC_Conversion(3); //Getting data of Left WL Sensor Center_white_line = ADC_Conversion(2); //Getting data of Center WL Sensor Right_white_line = ADC_Conversion(1); //Getting data of Right WL Sensor}
开发者ID:asabeeh18,项目名称:Embedded-C,代码行数:8,
示例5: scanint scan()//return the color no.{ red_read(); blue_read(); green_read(); _delay_ms(100); if(!(ADC_Conversion(11)>55 && ADC_Conversion(11)<100)) return EMPTY; if (red<threshold && green < threshold && blue < threshold) { return BLACK; } else { if (red > blue) { if (red > green) return RED; else return GREEN; } else if (blue > green) return BLUE; else return GREEN; }}
开发者ID:asabeeh18,项目名称:Embedded-C,代码行数:28,
示例6: main//-------------------------------------------------------------------------------//Main Function//-------------------------------------------------------------------------------int main(void){ init_devices(); while(1) { sensor_data_interpretation(); //print_sensor(1,1,1); //Prints IR Proximity Sensor 1 BATT_V = ADC_Conversion(0); BATT_Voltage = ((ADC_Conversion(0)*100)*0.07902) + 0.7; //Prints Battery Voltage Status lcd_print(1,1,BATT_Voltage,4); //print_sensor(1,1,0); //Prints Battery voltage binary value print_sensor(1,6,5); //Prints IR Proximity Sensor 1 print_sensor(1,10,6); //Prints vlaue of Analog IR Proximity Sensor 2 print_sensor(1,14,7); //Prints value of Analog IR Proximity Sensor 3 print_sensor(2,2,3); //Prints value of White Line Sensor1 print_sensor(2,6,2); //Prints Value of White Line Sensor2 print_sensor(2,10,1); //Prints Value of White Line Sensor3 //print_sensor(2,9,11); //Analog Value Of Front Sharp Sensor sharp = ADC_Conversion(11); //Stores the Analog value of front sharp connected to ADC channel 11 into variable "sharp" value = Sharp_GP2D12_estimation(sharp); //Stores Distance calsulated in a variable "value". lcd_print(2,14,value,3); }}
开发者ID:eYSIP-2016,项目名称:GUI-Testing-FirebirdV,代码行数:33,
示例7: bot_rotation360/*This function first rotates the bot by 5 degree till 360 Stores the voltage at each angle in arrayFind maximum value of voltage from the arrayAligns the bot at that value of voltage.*/void bot_rotation360(){ init_devices_motion(); init_devices_adc(); int bot_ang=0; float panel_voltage[72]; float max_panel_volt=0; float bat_voltage = 0.0; int j; for(j=0;j<72;j++) { soft_right(); // halting right wheel and moving only the left wheel for specified time to get the desired angle of rotation(according to calculation) _delay_ms(rot_time); // rot_time is calculated according to power from the battery stop(); _delay_ms(delay_time); panel_voltage[j]=value_in_volt(ADC_Conversion(10)); // channel 10 contains voltage reading lcd_print(2,1,panel_voltage[j],3); bat_voltage=batt_volt(ADC_Conversion(0)); lcd_print(1,13,bat_voltage,4); // Printing battery voltage. } _delay_ms(1000); // Stopping the bot momentarily. // for getting the angle of bot corresponding to maximum voltage and maximum voltage also. for( j=0;j<72;j++) { if(panel_voltage[j]>max_panel_volt) { max_panel_volt=panel_voltage[j]; bot_ang=j; } } lcd_print(2,1,panel_voltage[bot_ang],3); // Printing maximum voltage. // Realigning the bot at the maximum angle of intensity in circular plane j=1; while(j!=bot_ang) // Since the bot_ang variable contains the angle for which the intensity was maximum { soft_right(); //left wheel forward leaving the right wheel at rest to get //soft rotation at the axis of right wheel _delay_ms(rot_time2); float servo_volt=value_in_volt(ADC_Conversion(10)); lcd_print(2,5,servo_volt,3); j++; stop(); _delay_ms(delay_time); } lcd_print(2,5,panel_voltage[bot_ang],3); max_angle_of_bot=bot_ang; }
开发者ID:Ani1919,项目名称:CS101-Project,代码行数:66,
示例8: arenaUturnvoid arenaUturn(void){ nodeMissEnable = 0;/* stop(); _delay_ms(1000);*/ // velocity(forwardLeftSpeed, forwardRightSpeed);/* line_follow_mm(30); stop(); _delay_ms(1000); soft_right(); _delay_ms(1000);*/ stop(); _delay_ms(100); velocity(forwardLeftSpeed, forwardRightSpeed); left(); _delay_ms(2500); centre = ADC_Conversion(2); while(centre < 15) { centre = ADC_Conversion(2); } stop(); _delay_ms(100); nodeMissEnable = 1;}
开发者ID:kdsouza1496,项目名称:Cargo-alignment-robot,代码行数:35,
示例9: angle_rotate//Function used for turning robot by specified degreesvoid angle_rotate(unsigned int Degrees){ float ReqdShaftCount = 0; unsigned long int ReqdShaftCountInt = 0; ReqdShaftCount = (float) Degrees/ 4.090; // division by resolution to get shaft count ReqdShaftCountInt = (unsigned int) ReqdShaftCount; ShaftCountRight = 0; ShaftCountLeft = 0; while (1) { Left_white_line = ADC_Conversion(3); //Getting data of Left WL Sensor Center_white_line = ADC_Conversion(2); //Getting data of Center WL Sensor Right_white_line = ADC_Conversion(1); //Getting data of Right WL Sensor if((ShaftCountRight >= ReqdShaftCountInt) | (ShaftCountLeft >= ReqdShaftCountInt)) { break; } if((Left_white_line<0x20) && (Center_white_line>0x20) && (Right_white_line<0x20))//Black { break; } } stop(); //Stop robot}
开发者ID:adityashirodkar,项目名称:FireBird-V-Projects,代码行数:29,
示例10: getValue2 int getValue2(void){ value_front = ADC_Conversion(11); value_4sens= ADC_Conversion(12); value_2sens= ADC_Conversion(10); value_1sens=ADC_Conversion(9); }
开发者ID:kdsouza1496,项目名称:Cargo-alignment-robot,代码行数:8,
示例11: get_vectorvoid get_vector() {Left_white_line = ADC_Conversion(3);Center_white_line = ADC_Conversion(4);Right_white_line = ADC_Conversion(5);print_sensor(2,1,3); //Prints value of White Line Sensor Leftprint_sensor(2,5,4); //Prints value of White Line Sensor Centerprint_sensor(2,9,5); //Prints Value of White Line Sensor Right}
开发者ID:E-yantra,项目名称:astart_maze_solver_team18_CS308_2012,代码行数:8,
示例12: sensor_data_interpretationvoid sensor_data_interpretation(void) { SHARP_1 = ADC_Conversion(9); Left_white_line = ADC_Conversion(3); //Getting data of Left WL Sensor Center_white_line = ADC_Conversion(2); //Getting data of Center WL Sensor Right_white_line = ADC_Conversion(1); //Getting data of Right WL Sensor }
开发者ID:eYSIP-2016,项目名称:Robot_State_Collector,代码行数:9,
示例13: set_color/*--functions--*/void set_color(){ Left_white_line = ADC_Conversion(3); //Getting data of Left WL Sensor Center_white_line = ADC_Conversion(2); //Getting data of Center WL Sensor Right_white_line = ADC_Conversion(1); //Getting data of Right WL Sensor /*lcd_print(1,1,Left_white_line,3); //Prints value of White Line Sensor1 lcd_print(1,5,Center_white_line,3); //Prints Value of White Line Sensor2 lcd_print(1,9,Right_white_line,3); //Prints Value of White Line Sensor3 */}
开发者ID:asabeeh18,项目名称:Embedded-C,代码行数:11,
示例14: getError2int getError2(void){ int error; centre = ADC_Conversion(2); sensorLeft = ADC_Conversion(3); sensorRight = ADC_Conversion(1); lcd_print(2, 1, sensorLeft, 3); lcd_print(2, 5, centre, 3); lcd_print(2, 9, sensorRight, 3); if(sensorLeft > 40 && sensorRight > 40) error = 100; else if(centre > 90) error = 0; else if(sensorLeft > 45) error = 7; else if(sensorLeft > 25) error = 6; else if(sensorLeft > 17) error = 5; else if(sensorLeft > 9) error = 4; else if(sensorRight > 110) error = -7; else if(sensorRight > 85) error = -6; else if(sensorRight > 55) error = -5; else if(sensorRight > 35) error = -4; else if(sensorRight > 25) error = -3; else if(sensorRight > 18) error = -2; else if(sensorRight > 15) error = -1; else error = -100; return -error;}
开发者ID:kdsouza1496,项目名称:Cargo-alignment-robot,代码行数:55,
示例15: terminalCheck2void terminalCheck2(){ if (flag == 0) { if (dir == 0) if (ot == 0 || ot == 1) forward_mm(30); else back_mm(30); else if (ot == 0 || ot == 1) back_mm(30); else forward_mm(30); flag = 1; } if (((ct == 0 || ct == 1) && dir == 0) || ((ct == 2 || ct == 3) && dir == 2)) { left_degrees(30); velocity(turn_v, turn_v); while (ADC_Conversion(1)<70) left(); // _delay_ms(100); stop(); } else if (((ct == 0 || ct == 1) && dir == 2) || ((ct == 2 || ct == 3) && dir == 0)) { right_degrees(30); velocity(turn_v, turn_v); while (ADC_Conversion(1)<70) right(); // _delay_ms(100); stop(); } else { left_degrees(150); velocity(turn_v, turn_v); while (ADC_Conversion(1)<70) left(); // _delay_ms(100); stop(); } //printf("Enter term[%d][%d]/n", ct, 1); //scanf("%d", &term[ct][1]); term[ct][1] = scan(); if(term[ct][1]==-1) lcd_print(2,11,9, 1); else lcd_print(2,11, term[ct][1], 1); _delay_ms(1000); if (term[ct][1] == -1 || term[ct][1] == color[ct]) total--; visited[ct] = 1; visitedCount++;}
开发者ID:asabeeh18,项目名称:Embedded-C,代码行数:54,
示例16: Read_And_Printvoid Read_And_Print() { stop(); Left_white_line = ADC_Conversion(3); //Getting data of Left WL Sensor Center_white_line = ADC_Conversion(2); //Getting data of Center WL Sensor Right_white_line = ADC_Conversion(1); //Getting data of Right WL Sensor /*lcd_print(2, 1, Left_white_line, 3); lcd_print(2, 7, Center_white_line, 3); lcd_print(2, 13, Right_white_line, 3);*/}
开发者ID:tariqaligithub,项目名称:cs308_2014,代码行数:11,
示例17: servo_rotation_165/* Rotating the panel in the plane of servo hinge by one degree each till 165 Here we have rotated the servo only upto 165 not 180 due to large size of panel, that is when rotated by more than 165 it start touching the upper plate of bot. Here first the servo is rotated upto 165 each by one degree and the value corresponding to voltage is noted in the array then maximum value is calculated from the array and the corresponding angle. Then the panel is aligned to that angle. Delay time for each rotation is 400 milli-seconds.*/void servo_rotation_165(){ init_devices_servo(); unsigned int i = 0; float max_panel_volt=0.0; int counter=0; float panel_voltage_s[165]; for (i = 0; i <165; i++) { servo_1(i); _delay_ms(delay_time); panel_voltage_s[i]=value_in_volt(ADC_Conversion(10)); // ADC_Conversion gives analog value of voltage through channel 10 lcd_print(1,13,batt_volt(ADC_Conversion(0)),4); // Printing the battery voltage. lcd_print(2,9,panel_voltage_s[i],3); // Printing voltage of panel at specific angles. // _delay_ms(50); } // finding the maximum intensity of value and corresponding angle for(int j=0;j<165;j++) { if(panel_voltage_s[j]> max_panel_volt) { max_panel_volt= panel_voltage_s[j]; counter=j; // identifier counter contains the angle for which the intensity is maximum } } lcd_print(2,9,panel_voltage_s[counter],3); // Printing maximum voltage. // setting the panel at that angle of maximum intensity servo_panel_0(); for (int j = 0; j<counter;j++) // Setting the panel at maximum voltage. { servo_1(j); _delay_ms(delay_time); float panel_volt=value_in_volt(ADC_Conversion(10)); lcd_print(2,13,panel_volt,3); } lcd_print(2,13,panel_voltage_s[counter],3); // Checking the value to be exact by printing again. _delay_ms(1000); servo_1_free(); }
开发者ID:Ani1919,项目名称:CS101-Project,代码行数:59,
示例18: read_sensorvoid read_sensor(){ Left_white_line = ADC_Conversion(3); //Getting data of Left WL Sensor Center_white_line = ADC_Conversion(2); //Getting data of Center WL Sensor Right_white_line = ADC_Conversion(1); //Getting data of Right WL Sensor /* print_sensor(1,1,3); //Prints value of White Line Sensor1 print_sensor(1,5,2); //Prints Value of White Line Sensor2 print_sensor(1,9,1); //Prints Value of White Line Sensor3 */ lcd_print(1,1,Left_white_line,3); lcd_print(1,5,Center_white_line,3); lcd_print(1,9,Right_white_line,3); }
开发者ID:eyantra,项目名称:CS684_Autonomous-Path-Cleaner_and_Battery-Recharging-Bot_2013,代码行数:15,
示例19: mainint main(void){ cli(); set_ADC(); set_lcd(); sei(); PORTH |= 0x08; //Turn off the IR sharp sensors. PORTG |= 0x04; //Turn off the White line sensors. int sensors[5]; int i; while(1) { for(i=0; i<5; i++) { sensors[i] = ADC_Conversion(i+4); if(i==2) lcd_print(1, 7, sensors[i], 4); else if(i < 2) lcd_print(2, 4*(i) + 1, sensors[i], 3); else lcd_print(2, 4*(i-1) + 2, sensors[i], 3); } } return 0;}
开发者ID:kdsouza1496,项目名称:Cargo-alignment-robot,代码行数:30,
示例20: turnvoid turn() //turn robo by 180 degree{ if (dir == 0 && (ot == 2 || ot == 3)) { velocity(turn_v, turn_v); left_degrees(180); } else if (dir == 2 && (ot == 0 || ot == 1)) { velocity(turn_v, turn_v); left_degrees(180); } else { velocity(turn_v, turn_v); left_degrees(150); while (ADC_Conversion(2)<70) left(); stop(); } lcd("turn"); //_delay_ms(2000); dir = (dir + 2) % 4; //printf("Turn/n"); angle += 180;}
开发者ID:asabeeh18,项目名称:Embedded-C,代码行数:26,
示例21: main//Main Functionint main(void){ double error_p = 0.0; double error_i = 0.0; double error_d = 0.0; double angle; kalman_state k = kalman_init(1, 16, 1, 137); init_devices(); lcd_set_4bit(); lcd_init(); double preverror = 0.0; while(1) { sensor2 = ADC_Conversion(2); kalman_update(&k,(double)sensor2); angle = k.x; lcd_print(1,5,(int)angle,3); error_p = (angle - 137); error_i += error_p*dt; error_d = (error_p - preverror)/dt; lcd_print(1,1,abs((int)error_p),3); Disturbance = ((error_p*kp) + (error_i*ki) + (error_d*kd)); if(angle > 137) back(); else { forward();} if (Disturbance > MAX) Disturbance = MAX; if (Disturbance < MIN) Disturbance = MIN; lcd_print(2,6,abs((int)Disturbance),5); velocity(35+abs((int)Disturbance),35+abs((int)Disturbance)); preverror = error_p; }}
开发者ID:eyantra,项目名称:CS308_Self-Balancing-Bot_2012,代码行数:32,
示例22: print_sensor//Function To Print Sesor Values At Desired Row And Coloumn Location on LCDint print_sensor(char row, char coloumn,unsigned char channel){ ADC_Value = ADC_Conversion(channel); lcd_print(row, coloumn, ADC_Value, 3); return ADC_Value ;}
开发者ID:Sagar0410,项目名称:eYSIP_2015_PID_Based_Path_Planning-1,代码行数:9,
示例23: ADC_BlockMeasureuint16_t ADC_BlockMeasure(uint8_t channel, uint8_t block) { uint16_t ret = 0; while(block > 0) { ret += ADC_Conversion(channel); block--; } return(ret);}
开发者ID:v923z,项目名称:andris,代码行数:8,
示例24: thresholdvoid threshold(void){ while(x<=50){ threshold1 = ADC_Conversion(3); //Getting data of Left WL Sensor threshold2 = ADC_Conversion(4); //Getting data of Center WL Sensor threshold3 = ADC_Conversion(5); //Getting data of Right WL Sensor _delay_ms(20); x++; } if((threshold1>threshold2)&&(threshold1>threshold3)){ THRESHOLD=threshold1;} else if((threshold2>threshold3)&&(threshold2>threshold3)){ THRESHOLD=threshold2;} else{ THRESHOLD=threshold3;}//Getting maximum value of threshold1,2 & 3 THRESHOLD=THRESHOLD+20;lcd_print (2,9,THRESHOLD,3); }
开发者ID:abhi11796acharya,项目名称:Hazardous-Waste-Disposal,代码行数:17,
示例25: getErrorint getError(void){ int error; centre = ADC_Conversion(2); sensorLeft = ADC_Conversion(3); sensorRight = ADC_Conversion(1); lcd_print(2, 1, sensorLeft, 3); lcd_print(2, 5, centre, 3); lcd_print(2, 9, sensorRight, 3); if(sensorLeft > 15 && sensorRight > 15) error = 100; else if(centre > 30) error = 0; else if(sensorLeft > 75) error = 4; else if(sensorLeft > 50) error = 3; else if(sensorLeft > 11) error = 2; else if(sensorLeft > 9) error = 1; else if(sensorRight > 80) error = -4; else if(sensorRight > 35) error = -3; else if(sensorRight > 10) error = -2; else error = -100; return error;}
开发者ID:kdsouza1496,项目名称:Cargo-alignment-robot,代码行数:43,
示例26: Delay/*************************GULLA CODE**Blackline Forward***********/char Delay(int tim){ int i; for(i=0;i<tim && ADC_Conversion(2)<=40;i++) { //set_color(); _delay_ms(1); } stop(); if(i<tim) return 1; else return 0;}
开发者ID:asabeeh18,项目名称:Embedded-C,代码行数:14,
示例27: main//Main Functionint main(void){ init_devices(); while(1) { while((SPSR & 0x80) == 0x00); //wait for data reception to complete data = SPDR; //_delay_ms(1); //data = data + 1; ADC_Value = ADC_Conversion(data); SPDR = ADC_Value; while((SPSR & 0x80) == 0x00); //wait for data transmission to complete }}
开发者ID:Applecomps,项目名称:eyantra-firebird-resources,代码行数:16,
示例28: angle_rotate_right//rotate right degreevoid angle_rotate_right(){ ShaftCountRight = 0; ShaftCountLeft = 0; while (1) { Center_white_line = 0; for(temp=0; temp<AVERAGE_WL_COUNT; ++temp){ Center_white_line += ADC_Conversion(2); } Center_white_line/=AVERAGE_WL_COUNT; if((ShaftCountRight >= COUNT_LEFT_4) | (ShaftCountLeft >= COUNT_LEFT_4) | (Center_white_line > THRESHOLD_WL_C1) ) break; } motion_set(0x00); //Stop robot}
开发者ID:eyantrainternship,项目名称:eYSIP-2015_Swarm_Robotics_application,代码行数:19,
示例29: main/* * Main function, will call different phases, locate/clean */int main(void){ unsigned char sharp; unsigned int value=0; init_devices(); lcd_set_4bit(); lcd_init(); lcd_wr_command(0x0C);// Display ON Cursor OFF while(1) { if (phase == 1) { locate(); } sharp = ADC_Conversion(11); //Stores the Analog value of front sharp connected to ADC channel 11 into variable "sharp" value = Sharp_GP2D12_estimation(sharp); //Stores Distance calsulated in a variable "value". lcd_print(2,1,value,3); } servo_1_free(); return 0;}
开发者ID:eyantra,项目名称:CS684_Collaborative_cleaning_project_2010,代码行数:22,
示例30: turnLeftvoid turnLeft() //turns the robo left{ if ((dir == 1 && (ot == 0 || ot == 1)) || (dir == 3 && (ot == 2 || ot == 3))) { velocity(turn_v, turn_v); left_degrees(90); } else { left_degrees(30); velocity(turn_v,turn_v); while (ADC_Conversion(2)<70) left(); // _delay_ms(100); stop(); } lcd("Left turn"); //_delay_ms(2000); dir = (dir + 3) % 4; //printf("Turn Left/n"); angle += 90;}
开发者ID:asabeeh18,项目名称:Embedded-C,代码行数:22,
注:本文中的ADC_Conversion函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ADC_DMACmd函数代码示例 C++ ADC_CommonInit函数代码示例 |