test
Dependents: MouseHybridSenseCode
funcdef.h
- Committer:
- JamieBignell
- Date:
- 2018-03-11
- Revision:
- 5:dfea493f7a12
- Parent:
- 4:f1670eec4681
- Child:
- 6:a652deaae134
File content as of revision 5:dfea493f7a12:
//Define the file once, in the C and C++ programming languages, an #include guard,is a particular construct used to //avoid the problem of double inclusion when dealing with the include directive. The addition of #include guards to a header file is one way to make that file idempotent. #ifndef FUNCDEF_H #define FUNCDEF_H //Import Modules #include <mbed.h> //Set up PC link (comment out when not using), set up 9600 if using plotter static Serial pc = Serial(USBTX, USBRX); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Pin Names #define sensor1pin A0 #define sensor2pin A1 #define sensor3pin A2 #define sensor4pin A3 #define sensor5pin A4 #define sensor6pin A5 #define sensor7pin A6 #define sensor8pin D3 #define leftMotorpin D6 #define rightMotorpin D1 #define beeperPin D10 #define Kp 50 #define Ki 0 #define Kd 0 #define Ac 10 #define period_F6 716 #define period_E6 758 #define period_D6 851 #define period_B6 506 #define period_A6 568 //http://www.sengpielaudio.com/calculator-notenames.htm ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Pin Definitions static DigitalOut LEDVal = DigitalOut(LED1); static PwmOut leftMotorVal=PwmOut(leftMotorpin); static PwmOut rightMotorVal=PwmOut(rightMotorpin); static PwmOut beeperVal = PwmOut(beeperPin); static AnalogIn sensorPin[] = {A0,A1,A2,A3,A4,A5,A6,D3}; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Global Variable Definitions extern int sensorValue[8]; extern int sensorMinValue[8]; extern int sensorMaxValue[8]; extern int sensorMinValue1[8]; extern int sensorMaxValue1[8]; extern int sensorMinValue2[8]; extern int sensorMaxValue2[8]; extern int sensorThreshold[8]; extern int sensorErrors[8]; extern int Prop; //extern int Inte; //extern int Dere; extern int errorVar; extern int previousError; extern int PIDs; extern int accumulator; extern int counter; extern int delayBetweenPulses_ms; extern int note; extern int initialMotorspeed; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Function Definitions void CalibrateFunc(void); void printCalibrateValues(void); void beep(int); void senseFunc(void); void calculateFunc(void); void driveFunc(void); void findLineFunc(void); void errorAccumulate(void); #endif // FUNCDEF_H