//----------------------------------------------------------------------------- // Main Function //----------------------------------------------------------------------------- void main(void) { int heading = 0; // initialize board Sys_Init(); putchar(' '); //the quotes in this line may not format correctly Port_Init(); XBR0_Init(); PCA_Init(); SMB0CR = 0x93; // set the frequency of the i2c bus to 95.41 kHz ENSMB = 1; //enable the SMBus //print beginning message //printf("Embedded Control Steering Calibration\n"); //calibrate_steering(); //printf("\rCalibrated\n"); while(1){ //Steering_Servo(); //printf("H = %d\n",h_counts); if(h_counts%2){ //printf("We are in %d", h_counts); heading = read_compass(); } if(!h_counts){ printf("\rThe Heading is: %u\n", heading); //print the heading } //else{printf("\rthis is h_coutn %d\n",h_counts);} } }
void main(void) { Sys_Init(); //All init function putchar(' '); XBR0_Init(); ADC_Init(); Port_Init(); PCA_Init(); SMB_Init(); //end the init function lcd_clear(); lcd_print("initializing\r\n"); printf("\n\n\n\rinitalizing"); PCA0CP2 = 0xFFFF - MOTOR_NEUT;//set all to neutural PCA0CPL0 = 0xFFFF - PW_CENTER; PCA0CPH0 = (0xFFFF - PW_CENTER) >> 8; pause(); //pause for a second? start_run(); while (1) { while(SS){ // if the slideswitch is off slide_switch_off(); }///end slide switch off while(!SS){ //while the slideswitch is on Heading(); Ranger(); LCD_Print(); //print all values on the lcd printf("\n\rRange:%d Compass:%d dh: %d, mPW: %d, sPW %d, batt:%d, obst: %d", range, heading, desired_heading, MOTOR_PW_AND_STEER_PW, STEER_PW, battery, near_obstical); //print these on the secure crt for data aquisition //printf("\n\r Range:%d Compass:%d dh: %d, mPW: %d, sPW %d, obst: %d", range, heading, desired_heading, MOTOR_PW_AND_STEER_PW, STEER_PW, near_obstical); //print these on the secure crt for data aquisition }//end slide switch on } //end of the infinite while loop }//end of the main function
void main(void) { Sys_Init(); //All init function putchar(' '); XBR0_Init(); ADC_Init(); Port_Init(); PCA_Init(); SMB_Init(); //end the init function lcd_clear(); lcd_print("initializing\r\n"); PCA0CP2 = 0xFFFF - MOTOR_NEUT; PCA0CPL0 = 0xFFFF - PW_CENTER; PCA0CPH0 = (0xFFFF - PW_CENTER) >> 8; while (n_Counts < 50); //pause for a second? start_run(); while (1) { while(SS){ // if the slideswitch is off slide_switch_off(); }///end slide switch off while(!SS) //while the slideswitch is on { Heading(); Ranger(); LCD_Print(); //print all values on the lcd printf("\n\r Range:%d Compass:%d PW:%d", range, heading, PW); //print these on the secure crt for data aquisition } } //end of the infinite while loop }//end of the main function
void main(void) { Sys_Init(); putchar(' '); XBR0_Init(); SMB_Init(); PCA_Init(); Drive_Init(); Port_Init(); ADC_Init(); ranger_pd_init(); //fan angle initialization code goes here while(1) { voltage_update(); if(SS) { Range_Update(); //update the range Drive_Motor(ranger_pd()); } else Drive_Motor(PW_NEUT); //if ss is not flipped, put it in neutral } }
//******************************************************************** // Main Functions //******************************************************************** void main(void) { //Main function Sys_Init(); // initialize board putchar(' '); //the quotes in this line may not format correctly Port_Init();//Init ports XBR0_Init();//init xbro PCA_Init();//init pca SMB_Init();//init smb printf("\r\n\n\n\nEmbedded Control Electric Compass and Ranger\n"); //print beginning message Calibration();//Run calibration comp_cal(); //Compass calibration Choose_heading(); //Heading choice printf("\r\nheading error"); while(1) { //inf loop, 40 ms it returns the heading if (new_heading){ //enough overflows for a new heading COMPASS STUFF new_heading = 0;//Clear new_heading heading = ReadCompass(); //get compass heading Steering_Servo(); //run steer func }//end if new heading if (new_range) { //if 80 ms has passed new_range=0;//Clear new_range range=ReadRanger();//read ranger start_ping();//start ping counts++;//set up text function Drive_Motor(); //run drive func }//end if new_range if (counts == 3){ //prevoudly output prined every 200 ms, now every 180 ms print_output();//Print data function. Delete this if faster output is desired }//end if counts }//end inf while }//end main
// Initialization function for device, // Call Init_Device() from your main program void Init_Device(void) { Reset_Sources_Init(); PCA_Init(); Timer_Init(); ADC_Init(); Voltage_Reference_Init(); Port_IO_Init(); Oscillator_Init(); Interrupts_Init(); }
void main(void) { // initialize board Sys_Init(); putchar(' '); //the quotes in this line may not format correctly Port_Init(); PCA_Init(); SMB_Init(); Interrupt_Init(); printf("Starting\n\r"); //print beginning message printf("Embedded Control Drive Motor Control\r\n"); // Initialize motor in neutral and wait for 1 second MOTOR_PW = PW_NEUT; motorPW = 0xFFFF-MOTOR_PW; PCA0CPL2 = motorPW; PCA0CPH2 = motorPW>>8; printf("Pulse Width = %d\r\n",MOTOR_PW); c = 0; while (c < 50); //wait 1 second in neutral printf("end wait \r\n"); //Main Functionality while (1) { if (!SS1) { // If the slide switch is active, set PW to center PW = PWCENTER; PCA0CP0 = 0xFFFF - PW; // Update comparator with new PW value while (!SS1); // Wait... } else if (take_heading) { // Otherwise take a new heading reading = Read_Compass(); // Get current heading printf("%d\n\r", reading); Steering_Servo(reading); // Change PW based on current heading PCA0CP0 = 0xFFFF - PW; // Update comparator with new PW value } if (getRange) { getRange = 0; // Reset 80 ms flag range_val = read_ranger(); // Read the distance from the ranger printf("Range: %d cm \r\n", range_val); printf("Pulse Width: %d \r\n", MOTOR_PW); // Start a new ping Data[0] = 0x51; // write 0x51 to reg 0 of the ranger: i2c_write_data(addr, 0, Data, 1); // write one byte of data to reg 0 at addr } if (SS0) Drive_Motor(range_val); else Drive_Motor(45); // Hold the motor in neutral if the slide switch is off } }
void main(void) { Sys_Init(); putchar(' '); XBR0_Init(); PCA_Init(); i2c_Init(); while(1) { if (new_range) { new_range = 0; cmrange = ReadRanger(); Data[0] = 0x51; //write 0x51 to reg 0 of the ranger: i2c_write_data(ranger_addr, 0, Data, 1) ; // write one byte of data to reg 0 at addr printf("range = %d\r\n", cmrange); } } }
//------------------------------------------------------------------------------------ // MAIN Routine //------------------------------------------------------------------------------------ void main (void) { Intensite=80; // en % Lum_ON=20;// choisir valeur entre 1 et 100 Lum_OFF=10;// choisir valeur entre 1 et 100 Lum_Nbre=10; cpt=0; ON=1; nbOverflow=Lum_ON*4; // (x*10^-1)/(25*10^-3) rappel: un overflow tt les 25 ms Init_Device(); PCA_Init(); EA=1; // Autorisation interruptions Lumiere(); while (1) { // Boucle infinie } }
void main(void) { /*设置红外输出引脚为推挽输出*/ P1M1 = 0x00; P1M0 = 0x1C; /*PCA模块初始化*/ PCA_Init(); /*Timer定时器初始化*/ Timer0_Init(); /*串口初始化*/ Uart1_Init(); /*ADC的初始化*/ ADC_Init(); /*打开全局中断标识位*/ EA = 1; /*系统上电,管脚初始化*/ Signal_LED_PIN = 0; Check_Signal_PIN = 0; // #ifdef DEBUG // /*启动32HZ和38KHZ方波输出*/ // T38KHZ_Start(); // T32HZ_Start(); // Timer = 0; // // System_State = 1; // #endif /*输出初始化成功标识*/ printf("%s","INIT DONE \r\n"); while(1) { /*软件复位,不断电,自动下载*/ if(System_IAP_REST_PIN == 0) IAP_CONTR = 0x60; /***************************检查系统电极接触状态******************************/ if(ADC_Timer == 198) { ADC_Buffer = Get_ADC_Result(); printf("%d ",ADC_Buffer); /*清除系统状态*/ System_State = 0; if((ADC_Buffer > 140) && (ADC_Buffer <250)) { /*电极接触*/ System_State = 1; } if(System_State != System_State_Buffer) { if(System_State == 0) { T32HZ_Stop(); T38KHZ_Start(); } else if(System_State == 1) { T38KHZ_Stop(); T32HZ_Start(); } } System_State_Buffer = System_State; printf("%d ",System_State_Buffer); } else if(ADC_Timer == 200) { ADC_Timer = 0; } /*****************************************************************************/ /************************系统状态为充电电极未接触状态*************************/ if(System_State == 0) { /*****************************指示灯部分代码程序******************************/ /*未接触时,指示灯4S亮一次*/ if(Signal_LED_PIN_Timer < 50) { Signal_LED_PIN = 1; } else if(Signal_LED_PIN_Timer >= 3999) { Signal_LED_PIN_Timer = 0; Signal_LED_PIN = 0; } else { Signal_LED_PIN = 0; } /*****************************************************************************/ /****************************红外发射部分代码程序*****************************/ if((IR_Timer >= 0) && (IR_Timer < 50)) { /*全向红外发射序列*/ /*1*/ if((IR_Timer >= 0) && (IR_Timer < 3)) { LED_FF_PIN = 1; } else if(IR_Timer == 3) { LED_FF_PIN = 0; } /*0*/ else if(IR_Timer == 4) { LED_FF_PIN = 1; } else if((IR_Timer >= 5) && (IR_Timer < 7)) { LED_FF_PIN = 0; } /*0*/ else if(IR_Timer == 7) { LED_FF_PIN = 1; } else if((IR_Timer >= 8) && (IR_Timer < 10)) { LED_FF_PIN = 0; } /*1*/ else if((IR_Timer >= 10) && (IR_Timer < 13)) { LED_FF_PIN = 1; } else if(IR_Timer == 13) { LED_FF_PIN = 0; } /*0*/ else if(IR_Timer == 14) { LED_FF_PIN = 1; } else if((IR_Timer >= 15) && (IR_Timer < 17)) { LED_FF_PIN = 0; } /*1*/ else if((IR_Timer >= 17) && (IR_Timer < 20)) { LED_FF_PIN = 1; } else if(IR_Timer == 20) { LED_FF_PIN = 0; } /*0*/ else if(IR_Timer == 21) { LED_FF_PIN = 1; } else if((IR_Timer >= 22) && (IR_Timer < 24)) { LED_FF_PIN = 0; } /*1*/ else if((IR_Timer >= 24) && (IR_Timer < 27)) { LED_FF_PIN = 1; } else { LED_FF_PIN = 0; } } else if((IR_Timer >= 50) && (IR_Timer < 100)) { /*左右侧红外发送序列*/ /*L:0 R:0*/ if(IR_Timer == 50) { LED_L_PIN = 1; LED_R_PIN = 1; } else if((IR_Timer >= 51) && (IR_Timer < 53)) { LED_L_PIN = 0; LED_R_PIN = 0; } /*L:0 R:0*/ else if(IR_Timer == 53) { LED_L_PIN = 1; LED_R_PIN = 1; } else if((IR_Timer >= 54) && (IR_Timer < 56)) { LED_L_PIN = 0; LED_R_PIN = 0; } /*L:1 R:0*/ /*L:0 R:1*/ else if(IR_Timer == 56) { LED_L_PIN = 1; LED_R_PIN = 1; } else if((IR_Timer >= 57) && (IR_Timer < 59)) { LED_L_PIN = 1; LED_R_PIN = 0; } else if(IR_Timer == 59) { LED_L_PIN = 0; LED_R_PIN = 1; } else if(IR_Timer == 60) { LED_L_PIN = 1; LED_R_PIN = 1; } else if(IR_Timer == 61) { LED_L_PIN = 0; LED_R_PIN = 1; } else if(IR_Timer == 62) { LED_L_PIN = 0; LED_R_PIN = 0; } /*L:0 R:0*/ else if(IR_Timer == 63) { LED_L_PIN = 1; LED_R_PIN = 1; } else if((IR_Timer >= 64) && (IR_Timer < 66)) { LED_L_PIN = 0; LED_R_PIN = 0; } /*L:1 R:1*/ else if((IR_Timer >= 66) && (IR_Timer < 69)) { LED_L_PIN = 1; LED_R_PIN = 1; } else if(IR_Timer == 69) { LED_L_PIN = 0; LED_R_PIN = 0; } /*L:0 R:0*/ else if(IR_Timer == 70) { LED_L_PIN = 1; LED_R_PIN = 1; } else if((IR_Timer >= 71) && (IR_Timer < 73)) { LED_L_PIN = 0; LED_R_PIN = 0; } /*L:1 R:1*/ else if((IR_Timer >= 73) && (IR_Timer < 76)) { LED_L_PIN = 1; LED_R_PIN = 1; } else { LED_L_PIN = 0; LED_R_PIN = 0; } } else if((IR_Timer >= 100)) { IR_Timer = 0; LED_FF_PIN = 0; LED_L_PIN = 0; LED_R_PIN = 0; } /*****************************************************************************/ } /**************************统状态为充电电极接触状态***************************/ else if(System_State == 1) { /*****************************指示灯部分代码程序******************************/ /*接触时,指示灯常量*/ Signal_LED_PIN = 1; Signal_LED_PIN_Timer = 0; /*****************************************************************************/ /************************发射检测信号部分代码程序*****************************/ if(Check_Signal_Timer < 190) { Check_Signal_PIN = 1; } else if((Check_Signal_Timer >= 197) && (Check_Signal_Timer < 200 )) { Check_Signal_PIN = 0; } else if(Check_Signal_Timer >= 200) { Check_Signal_Timer = 0; Check_Signal_PIN = 1; } /*****************************************************************************/ } } }
//----------------------------------------------------------------------------- // Main Function //----------------------------------------------------------------------------- void main(void) { // initialize board Sys_Init(); putchar(' '); //the quotes in this line may not format correctly Port_Init(); XBR0_Init(); PCA_Init(); ADC_Init(); SMB_Init(); //drive motor config printf("\rBegin Speed Controller Initialization\n"); PCA0CPL2 = 0xFFFF - PW_SC; PCA0CPH2 = (0xFFFF - PW_SC) >> 8; counts = 0; while(counts < 100); //wait 1 second printf("\rSC init finished\n"); //start_ping(); // set the PCA output to a neutral setting PW_SS = PW_CENTER_SS; PCA0CPL0 = 0xFFFF - PW_SS; PCA0CPH0 = (0xFFFF - PW_SS)>>8; /* //print beginning message printf("Embedded Control Steering Calibration\n"); printf ("\n\rr or l for direction, space for center, then right, then left\n\r"); while (flag < 3) { Steering_Config(); } */ //select heading/gain desired_heading = pick_heading(); gain_SS = pick_gain(); while(1) { //steering servo //ultrasonic ranger if(!SS1){ //switch is on Steering_Servo(); Ultrasonic_Ranger(); run_stop = 1; } else if(run_stop) { PW_SC = PW_NEUTRAL_SC; //drive motor stop PCA0CPL2 = 0xFFFF - PW_SC; PCA0CPH2 = (0xFFFF - PW_SC) >> 8; desired_heading = pick_heading(); gain_SS = pick_gain(); run_stop = 0; } if(new_display) { new_display = 0; Print_LCD(); } } }
//----------------------------------------------------------------------------- // Main Function //----------------------------------------------------------------------------- void main(void) { desired_range = 150; // initialize board Sys_Init(); putchar(' '); //the quotes in this line may not format correctly PCA_Init(); ADC_Init(); Interrupt_Init(); Port_Init(); XBR0_Init(); SMB_Init(); putchar('\r'); //print beginning message printf("En taro Adun, Executor!\r\n"); // set the PCA output to a neutral setting steering_neutral(); ranger_neutral(); wait(); /* Let stuff warm up */ // Get the PD constants and target heading from the keypad compass_kp = read_gain()/10.; desired_heading = read_heading(); compass_kd = read_gain_high(); ranger_kp = read_gain_thrust()/10.; ranger_kd = read_gain_thrust_high(); //Write the settings to the record printf ( "Compass KP = %d, Compass KD = %d, Desired Heading = %d, Ranger KP = %d, Ranger KD = %d, Desired Range = %d\r\n", compass_kp, compass_kd, desired_heading, ranger_kp, ranger_kd, desired_range ); printf ( "Time, heading, range\r\n "); PCA0CPL1 = 0xFFFF - 3200; PCA0CPH1 = ( 0xFFFF - 3200 ) >> 8 ; // Start at time 0. time = 0; while(1) /* Infinite loop is go */ { if ( nCounts == 50 ) { // Update the LCD loop lcd_clear(); lcd_print( "Batt level: %d\n", get_battery_voltage() ); lcd_print("Heading :%d\n", heading/10); lcd_print("Alt: %d", range ); if (SS) lcd_print("PAUSED\n"); else lcd_print("\n"); lcd_print("# forHead, * forGain"); } if ( read_keypad() != -1 ) { // Check the keypad pause(); if ( getKey() == '#' ) { // If # was pressed, get a new heading steering_neutral(); ranger_neutral(); desired_heading = read_heading(); time = 0; printf ( "Compass KP = %d, Compass KD = %d, Desired Heading = %d, Ranger KP = %d, Ranger KD = %d, Desired Range = %d\r\n", compass_kp, compass_kd, desired_heading, ranger_kp, ranger_kd, desired_range ); printf ( "Time, heading, range\r\n "); } else if( getKey() == '*' ) { // If * was pressed, get new gain contants steering_neutral(); ranger_neutral(); compass_kp = read_gain()/10.; compass_kd = read_gain_high(); ranger_kp = read_gain_thrust()/10.; ranger_kd = read_gain_thrust_high(); time = 0; printf ( "Compass KP = %d, Compass KD = %d, Desired Heading = %d, Ranger KP = %d, Ranger KD = %d, Desired Range = %d\r\n", compass_kp, compass_kd, desired_heading, ranger_kp, ranger_kd, desired_range ); printf ( "Time, heading, range\r\n "); } } else pause(); if(SS) //while the SS is off { //printf("The slide switch is OFF \r\n"); steering_neutral(); ranger_neutral(); } if(!SS) //SS is On { //printf("The Slide switch is On \r\n"); if ( new_heading ) printf("%lu,%d,%d\r\n", time, compass_old_error, ranger_old_error ); if (new_heading) //wait for 40ms { heading=read_compass(); //printf("The heading result is %d\r\n", heading); new_heading=0; Steering_Servo( ); } if (new_range) { ReadRanger( ); Speed_Cont( ); //adjust motor speed new_range=0; //reset ranger flag } } } }
int main(int argc, char* argv[]) { #ifdef __linux__ struct sigaction sig_struct; sig_struct.sa_handler = sig_handler; sig_struct.sa_flags = 0; sigemptyset(&sig_struct.sa_mask); if (sigaction(SIGINT, &sig_struct, NULL) == -1) { cout << "Problem with sigaction" << endl; exit(1); } #endif // __linux__ /// === File read needed if moving something from PC to here // myFP = fopen(netname, "a+"); // if(myFP == NULL) // { // cout<<"ERROR opening"<<endl; // exit(1); // } // fread(read_buf, 1, 100, myFP); // int buffersize = strlen(read_buf); // fclose(myFP); // cout<<"read the file: "<<read_buf<<endl; // ============================================================= int lcdp=lcd_open(); int adcp=ADS1015_Init("/dev/i2c-1"); PCA9685 myPCA={0x40, 0, 69, 0, 0, 0x11, 0x4, 50, 0x79,}; // control structure myPCA.file=PCA_Init("/dev/i2c-1"); PCA9685_start(myPCA.file); //adcresult=read_convert_register(adcp); //sprintf(dis_buf, "ADC: %6.3f V", adcresult); //lcd_write(dis_buf); lcd_write("Hello from Steve's\nLCD stuff"); lcd_clear(); get_NIST(); mcp23s17_enable_interrupts(GPIO_INTERRUPT_PIN); //mcp23s17_enable_interrupts(SW_GPIO_INTERRUPT_PIN); cout.setf(ios::fixed); //=== SET CURRENT TIME ========================== struct tm *newtime; //--- for time now time_t long_time; //--- Get time as long integer. double DeltaT=0.0; //--- time since is in minutes Observer PLACENTIA={"Yorba Linda",Rad(33.909),Rad(-117.782),30.0,0}; //Observer PHILLY={"Philly",Rad(40.0),Rad(-75.0),0.0,0}; double sdctime; SATELSET Eset; SATPOS satpos; //ELLIPSE myEllipse; //double SP,JDG,E2JD,JDN; double JDG,E2JD,JDN; VectorIJK test,test1; //ptest; //VectLook testlook; SATSUB SB; clock_t goal; clock_t wait=(clock_t)2 * CLOCKS_PER_SEC; // change the 2 for update rate, 2= about 2 seconds Read_TLE(argv[1], Eset); // read the 2 line data do { time( &long_time ); newtime=gmtime( &long_time ); // time, expressed as a UTC time, GMT timezone JDN=JD_Now(newtime); //--- JD based on system clock as GMT JDG=ThetaG_JD(JDN); //--- in radians E2JD=Epoch2JD(Eset.iEpochYear,Eset.dEpochDay); //--- JD based on TLE epoch double local_time=0.0; double test_time=0.0; local_time=newtime->tm_yday+1+(newtime->tm_hour+(newtime->tm_min+newtime->tm_sec/60.0)/60.0)/24.0; test_time=local_time-Eset.dEpochDay; //cout<<"test_time delta days "<<test_time<<endl; test_time*=1440.0; //cout<<"test_time delta minutes "<<test_time<<endl; /************************************** local_time minus Eset.dEpochDay matches JDN-E2JD. And is easier to check and calculate and no need for all the JD and JD0 code. *************************************/ sdctime=JDN-E2JD; //--- delta days sdctime*=1440.0; // delta minutes //sdctime=fmod(sdctime,60); //cout<<"Current sdctime "<<sdctime<<endl; DeltaT=sdctime; //satpos=SatPos(DeltaT, &Eset); //--- get satellite position satpos=clean_SatPos(DeltaT, &Eset); cout<<"=====Satellite ECI position============================\n"<<satpos; test=Obs_Position(PLACENTIA,JDG); //--- get observer position //test1=Obs_to_ECI(PHILLY,JDG); //-- test data from TS Kelso test1=Obs_to_ECI(PLACENTIA,JDG); testlook=LookAngles(satpos, PLACENTIA,JDG); //--- get look angles SB= SatSubPoint(satpos,JDG); cout<<"=====Observer ECI====================\n"<<test1; cout<<"=====Observer Look angles============\n"<<testlook; // for antenna tracker cout<<"=====Sat Sub Point===================\n"<<SB; /// used before //int s_count=read_convert_register_count(adcp); //set_count(myPCA.file, 0, 5, s_count); // file channel, start count, end count /// LCD setup and stuff adcresult=read_convert_register_volts(adcp); sprintf(dis_buf, "ADC: %6.3f V", adcresult); lcd_write(dis_buf); /// aztovolts is the target reference position double aztovolts = (Deg(testlook.AZ)) * (3.2/360.0); /// wtf is the difference of the pot input, adcresults, and reference double wtf = aztovolts - adcresult; /// double - float printf("\nVOLTS ADC: %6.3f V\n",adcresult); printf("AZ Degrees: %6.3f \n",Deg(testlook.AZ)); printf("AZ to volts: %6.3f V\n",aztovolts); printf("DELTA: %6.3f \n",wtf); /** volts 0 1.6 3.2 count 200 320 450 max left no motion max right 1 ms 1.5 ms 2ms 50 hz timing **/ /// for applying delta Vin //float PCAcount = (wtf*80)+320; ///this is for 0 - 3.2 Vin float PCAcount = (wtf*80)+300; ///this is for 0 - 3.2 Vin, 340 from measurements if(wtf< -1.25) PCAcount = 240; else if(wtf> 1.25) PCAcount = 425; //set_count(myPCA.file, 0, 5, PCAcount); // file channel, start count, end count set_count(myPCA.file, 0, 1, PCAcount); // file channel, start count, end count //set_count(myPCA.file, 1, 1, PCAcount); // file channel, start count, end count printf("MOTOR count: %6.3f \n",PCAcount); //#define TRACK 0 //#define LOCATION 1 //#define SATDATA 2 //#define NIST 3 if(display_count < 5) { display_control(TRACK, PLACENTIA, SB, Eset, testlook); display_count++; LED_off(GPIO_INTERRUPT_PIN); } else { display_control(LOCATION, PLACENTIA, SB, Eset, testlook); display_count++; LED_on(GPIO_INTERRUPT_PIN); } if(display_count > 10) { display_count = 0; } /** ==================== Look angles:visible AZ:123456 EL:123456 Sat LAT/LONG LT:123456 LG:123456 ==================== Location Yorba Linda LT:123456 LG:123456 Range: 123456 ==================== Tracking:ISS (ZARYA) Incl:12345 MM: 123456 MA: 123456 **/ /// LCD done goal = wait + clock(); while( goal > clock() ); #ifdef __linux__ if(ctrl_c_pressed) { cout << "Ctrl^C Pressed" << endl; cout << "unexporting pins" << endl; //gpio26->unexport_gpio(); //gpio16->unexport_gpio(); mcp23s17_disable_interrupts(GPIO_INTERRUPT_PIN); //mcp23s17_disable_interrupts(SW_GPIO_INTERRUPT_PIN); cout << "deallocating GPIO Objects" << endl; //delete gpio26; //gpio26 = 0; //delete gpio16; //gpio16 =0; break; } #endif // __linux__ } #ifdef __linux__ while(1); #elif _WIN32 while(!(_kbhit())); #else #endif //while(1); //while(!(_kbhit())); //pthread_exit(NULL); set_all(myPCA.file, 0, 0); /// kill the servos lcd_close(); /// kill the LCD return 0; }