Error compiling for board Arduino/Genuino Uno on arduino

hi everyone. I have a problem. please help me. i don’t know fix them thanks!
my code:

#include <TimerOne.h>
#define TRIG_PIN 8
#define ECHO_PIN 7
#define TIME_OUT 5000
int En = 5;
double h;
double h_init;
double E, E1, E2, alpha, gamma, beta;
double Kp, Kd, Ki;
double T;
volatile double Output = 0;
double LastOutput = 0;

float GetDistance()
{
double duration, distance;
digitalWrite(TRIG_PIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);

duration = pulseIn( ECHO_PIN, HIGH, TIME_OUT);
distance = duration / 29.1 / 2;
return distance;
}
void PID()
{
double x = GetDistance();
h_init = 47 - x;
E = h - h_init;
alpha = 2 * T * Kp + Ki * T * T - 2 * Kd;
beta = T * T * Ki - 4 * Kd - 2 * T * Kp;
gamma = 2 * Kd;
Output = (alpha * E + beta * E1 + gamma * E2 + 2 * T * LastOutput) / (2 * T);
LastOutput = Output;
E2 = E1;
E1 = E;
if (h_init <=h)
analogWrite( En, Output);
else if (h_init > h )
analogWrite(En, 0);
Serial.println(h_init);
}
void setup()
{
Serial.begin(9600);
pinMode(TRIG_PIN, OUTPUT);
pinMode(ECHO_PIN, INPUT);
pinMode(En, OUTPUT);

Kp = 2; Kd = 0.1; Ki = 1;

E = 0; E1 = 0; E2 = 0;
h = 10;
T = 0.1;

Timer1.initialize(100000);
Timer1.attachInterrupt(PID);
}

Please read How to use the forum.

If you did, you would have seen that you should post code in code-tags and also to post the full error. So please edit your post to have both.

thank you.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

What is the code supposed to to do, what is the application?

Thanks... Tom... :slight_smile:

Where is your loop()?

Can you fix it for me?

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. Using code tags and other important information is explained in the How to use this forum post. Please read it.

When your code requires a library that’s not included with the Arduino IDE please always post a link(using the chain link icon on the toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger(Sketch > Include Library > Manage Libraries) then say so and state the full name of the library.

When you encounter an error you’ll see a button on the right side of the orange bar “Copy error messages”. Click that button. Paste the error in a message here USING CODE TAGS (</> button on the toolbar).