error while compiling

HI, i am new to this, I couldn't understand a error displayed while I compile my program for parking sensor, any inputs will be much appreciated

This report would have more information with "Show verbose output during compilation" enabled in File > Preferences. Arduino: 1.0.6 (Windows 7), Board: "Arduino Uno" sketch_nov25b.ino: In function 'void setup()': sketch_nov25b:23: error: 'Timer1' was not declared in this scope

I couldn't understand a error displayed while I compile my program for parking sensor

Which one? This one? error: 'Timer1' was not declared in this scope?

Seems quite obvious to me. You are trying to use a variable you have not defined. You can't do that.

can you please help me fix this, since I couldn't fix, This might be a small error, but I'm just learning this now

can you please help me fix this

Without seeing your code? Well, my crystal ball says that you need to fix line 23, but it seems quite undecided on what you need to do. The most consistent view I get is of you kissing President Obama, but I really can’t see that happening.

Imagine going to the garage and saying "My car doesn't work, please fix it. Oh, by the way, I left my car at home"

I was about to post the program, I never thought the forum will be so quick, sorry for messing around

#include <TimerOne.h>

#define trigPin 4
#define echoPin 2
#define onLED 12
#define echo_int 0
#define Timer1

#define TIMER_US 50
#define TICK_COUNTS 4000

volatile long echo_start = 0;
volatile long echo_end = 0;
volatile long echo_duration = 0;
volatile int trigger_time_count = 0;
volatile long range_flasher_counter = 0;

void setup()
{
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(onLED, OUTPUT);

Timer1.initialize(TIMER_US);
Timer1.attachInterrupt( timerIsr );
attachInterrupt(echo_int, echo_interrupt, CHANGE);
Serial.begin (9600);
}

void loop()
{
Serial.println(echo_duration / 58);
delay(100);
}

void timerIsr()
{
trigger_pulse();
distance_flasher();
}

void trigger_pulse()
{
static volatile int state = 0;

if (!(–trigger_time_count))
{
trigger_time_count = TICK_COUNTS;
state = 1;
}

switch(state)
{
case 0:
break;

case 1:
digitalWrite(trigPin, HIGH);
state = 2;
break;

case 2:
default:
digitalWrite(trigPin, LOW);
state = 0;
break;
}
}

void echo_interrupt()
{
switch (digitalRead(echoPin))
{
case HIGH:
echo_end = 0;
echo_start = micros();
break;

case LOW:
echo_end = micros();
echo_duration = echo_end - echo_start;
break;
}
}

void distance_flasher()
{
if (–range_flasher_counter <= 0)
{
if (echo_duration < 25000)
{
range_flasher_counter = echo_duration * 2;
}
else
{
range_flasher_counter = 25000;
}

digitalWrite( onLED, digitalRead( onLED ) ^ 1 );
}
}

Some useful reading here

Even more here

I'm still getting the following error, no idea how to solve this please help with a hint

This report would have more information with "Show verbose output during compilation" enabled in File > Preferences. Arduino: 1.0.6 (Windows 7), Board: "Arduino Uno" sketch_nov30a.ino: In function 'void setup()': sketch_nov30a:24: error: expected primary-expression before '.' token sketch_nov30a:25: error: expected primary-expression before '.' token

Again, we're not mind-readers, and can't see your code, but it looks like your errors are in your setup function.

I have used the same code which I posted earlier in this post, tried to download the library, compile , then the above error occured

OK, in that case, look carefully at the error messages.
They mention the ‘.’ character and the setup function.
Look at the setup function and see where the ‘.’ character occurs.

That’s where your errors are.

Whilst you’re looking at the code above, you could edit in the code tags you forgot.

This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: “Arduino Uno”
sketch_nov30a.ino: In function ‘void setup()’:
sketch_nov30a:24: error: expected primary-expression before ‘.’ token
sketch_nov30a:25: error: expected primary-expression before ‘.’ token

I am getting the above error for the following program

#include <TimerOne.h>

#define trigPin 4
#define echoPin 2
#define onLED 12
#define echo_int 0
#define Timer1

#define TIMER_US 50
#define TICK_COUNTS 4000

volatile long echo_start = 0;
volatile long echo_end = 0;
volatile long echo_duration = 0;
volatile int trigger_time_count = 0;
volatile long range_flasher_counter = 0;

void setup()
{
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(onLED, OUTPUT);

Timer1.initialize(TIMER_US);
Timer1.attachInterrupt( timerIsr );
attachInterrupt(echo_int, echo_interrupt, CHANGE);
Serial.begin (9600);
}

void loop()
{
Serial.println(echo_duration / 58);
delay(100);
}

void timerIsr()
{
trigger_pulse();
distance_flasher();
}

void trigger_pulse()
{
static volatile int state = 0;

if (!(–trigger_time_count))
{
trigger_time_count = TICK_COUNTS;
state = 1;
}

switch(state)
{
case 0:
break;

case 1:
digitalWrite(trigPin, HIGH);
state = 2;
break;

case 2:
default:
digitalWrite(trigPin, LOW);
state = 0;
break;
}
}

void echo_interrupt()
{
switch (digitalRead(echoPin))
{
case HIGH:
echo_end = 0;
echo_start = micros();
break;

case LOW:
echo_end = micros();
echo_duration = echo_end - echo_start;
break;
}
}

void distance_flasher()
{
if (–range_flasher_counter <= 0)
{
if (echo_duration < 25000)
{
range_flasher_counter = echo_duration * 2;
}
else
{
range_flasher_counter = 25000;
}

digitalWrite( onLED, digitalRead( onLED ) ^ 1 );
}
}
[/quote]

What happened to the code tags you were asked to add?

 Timer1.initialize(TIMER_US);                       
 Timer1.attachInterrupt( timerIsr );

Lines 24 and 25. What precedes the . that the compiler is complaining about? Timer1 in both cases. Looks to me like you do not have the TimerOne library installed (in the right place).

Actually at the top you have Timer1 #define to be nothing. So it gets replaced in the text of the code with nothing before it goes to the compiler. So the compiler sees that line as:

.initialize(TIMER_US);

Which is obviously an error.

sharif_dpi:
This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: “Arduino Uno”
sketch_nov30a.ino: In function ‘void setup()’:
sketch_nov30a:24: error: expected primary-expression before ‘.’ token
sketch_nov30a:25: error: expected primary-expression before ‘.’ token

I am getting the above error for the following program

#include <TimerOne.h>

#define trigPin 4
#define echoPin 2
#define onLED 12
#define echo_int 0
#define Timer1

#define TIMER_US 50
#define TICK_COUNTS 4000

volatile long echo_start = 0;
volatile long echo_end = 0;
volatile long echo_duration = 0;
volatile int trigger_time_count = 0;
volatile long range_flasher_counter = 0;

void setup()
{
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(onLED, OUTPUT);

Timer1.initialize(TIMER_US);
Timer1.attachInterrupt( timerIsr );
attachInterrupt(echo_int, echo_interrupt, CHANGE);
Serial.begin (9600);
}

void loop()
{
Serial.println(echo_duration / 58);
delay(100);
}

void timerIsr()
{
trigger_pulse();
distance_flasher();
}

void trigger_pulse()
{
static volatile int state = 0;

if (!(–trigger_time_count))
{
trigger_time_count = TICK_COUNTS;
state = 1;
}

switch(state)
{
case 0:
break;

case 1:
digitalWrite(trigPin, HIGH);
state = 2;
break;

case 2:
default:
digitalWrite(trigPin, LOW);
state = 0;
break;
}
}

void echo_interrupt()
{
switch (digitalRead(echoPin))
{
case HIGH:
echo_end = 0;
echo_start = micros();
break;

case LOW:
echo_end = micros();
echo_duration = echo_end - echo_start;
break;
}
}

void distance_flasher()
{
if (–range_flasher_counter <= 0)
{
if (echo_duration < 25000)
{
range_flasher_counter = echo_duration * 2;
}
else
{
range_flasher_counter = 25000;
}

digitalWrite( onLED, digitalRead( onLED ) ^ 1 );
}
}

I have installed both the timerone library version 9 and version 11, but still the same error is displayed, please help me with valid inputs

please help me with valid inputs

When you can't be bothered to post your code properly? Why should we?\

Did you read reply #14? What did you do about it? Nothing.

Your problem was already pinpointed in reply #14.

PaulS: When you can't be bothered to post your code properly? Why should we?

I have quoted the code, I am just learning the rules to post in this forum, please apologies

PaulS: When you can't be bothered to post your code properly? Why should we?\

Did you read reply #14? What did you do about it? Nothing.

I don't know what to do actually, I think i'm lost