-2

output not declaired.anyone please help me to fix this problem

int const trigpin=10;
int const echopin=9;
int const buzzpin=2;
void setup() 
{
  {
  Serial.begin(9600); 
 }
  pinmode(trigpin,output);
  pinmode(echopin,input);
  pinmode(buzzpin,output);
}
void loop() 
{
  long int duration,distance;
  digitalwrite(trigpin,high);
  delaymicroseconds(1000);
  digitalwrite(trigpin,low);
  duration=pulsein(echopin,high);
  distance=(duration/2)/29.1;
  Serial.print(distance);
  Serial.println("CH");
  if(distance<=50)
   {
    digitalwrite(buzzpin,high);
   }
   else if(distance>50)
   {
    digitalwrite(buzzpin,low);
   }
   delay(60);
}
4

To be used in the pinMode function (note capital M), it needs to be all capitals, ie OUTPUT.

From a quick scan, you might also need the following changes:

output ==> OUTPUT

input ==> INPUT

pinmode ==> pinMode

digitalwrite ==> digitalWrite

delaymicroseconds ==> delayMicroseconds

Make sure your code matches the case (uppercase/lowercase) of the examples/tutorials etc.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.