'pulseTime1' was not declared in this scope


so have lot of code, , won't bother posting of here....i'm running arduino 17 (the latest afaik) , i'm getting error "'pulsetime1' not declared in scope" when run it.  i've seen problem when trying call function older form of ide, weird.  here's includes @ beginning

code: [select]
#include <softwareserial.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>


and here's function i'm having problems with.  help?

code: [select]
void run_sonar(){

 for(i=1;i<4;i++)
   pulsetime[i] = 0;

 // send sensor 10microsecond pulse:
 digitalwrite(init_pin, high);
 delaymicroseconds(10);
 digitalwrite(init_pin, low);

 // wait pulse return. pulse
 // goes low high low, specify
 // want high-going pulse below:

 pulsetime1 = pulsein(echo1_pin, high,30000);        //times out after 30us.
 pulsetime2 = pulsein(echo2_pin, high,30000);
 pulsetime3 = pulsein(echo3_pin, high,30000);

 // distance in inches object
 // us/148

 objdistance1 = pulsetime1/148;
 objdistance2 = pulsetime2/148;
 objdistance3 = pulsetime3/148;
}


error: 'pulsetime1' not declared in scope

i suspect help...

code: [select]
 pulsetime[1] = pulsein(echo1_pin, high,30000);        //times out after 30us.
 pulsetime[2] = pulsein(echo2_pin, high,30000);
 pulsetime[3] = pulsein(echo3_pin, high,30000);
 // ...
 objdistance1 = pulsetime[1]/148;
 objdistance2 = pulsetime[2]/148;
 objdistance3 = pulsetime[3]/148;



Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > 'pulseTime1' was not declared in this scope


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums