erro : sketch_apr24a:36: error: 'class Ultrasonic' has no member named 'Ranging'

codigo fonte:

#include <Ultrasonic.h>
#define echoPin 13
#define trigPin 12

Ultrasonic ultrasonic(12,13);
int ledPin = 9;

void setup()
{
Serial.begin(9600);
pinMode(echoPin, INPUT);
pinMode(trigPin, OUTPUT);
pinMode(ledPin, OUTPUT);

}
void loop()
{
digitalWrite(ledPin, LOW);
int valor = func_distancia_ultrasonico();
if(valor <=15)
{
digitalWrite(ledPin, HIGH);
delay(100);
}
delay(500);
}
int func_distancia_ultrasonico()
{
digitalWrite(trigPin, LOW);
delayMicroseconds(2);

digitalWrite(trigPin, HIGH);
delayMicroseconds(10);

digitalWrite(trigPin, LOW);
int distancia = (ultrasonic.Ranging(CM));
Serial.print("Distancia em CM: ");
Serial.println(distancia);
return distancia;
}

Exibições: 1882

Responder esta

Respostas a este tópico

Danilo,

Deve ser problema da versão do seu programa do Arduino.

No meu micro, versão 1.0.4, compilou sem erro.

[],

Mauro

o meu é 1.0.4 tambem mais não compila, fala desse tal de "ranging" vc tem ai as bibliotecas do Ultrasonic? se tiver manda para mim.

Obrigado Mauro pela ajuda....

Me mande o seu email, o meu é assismauro_arroba_hotmail.com

meu email é 

danilorformenti@hotmail.com

Posso patentear um prototipo? feito no arduino? ele é livre.

Quanto ao problema de conversão...Ta com cara de ser problema COM VERSÃO..

Esta versão da biblioteca compilou e funcionou teu código sem problemas.

Até mesmo a versão antiga funcionou tanto com a Arduino.h 1.0.1 como na 1.0.4.

Ou o arquivo .cpp da biblioteca que tens aí ta com problema.

Ranging é uma função encontrada no arquivo .cpp

long Ultrasonic::Ranging(int sys)
{
  Timing();
  distacne_cm = duration /29 / 2 ;
  distance_inc = duration / 74 / 2;
  if (sys)
  return distacne_cm;
  else
  return distance_inc;
}

chamada no .h

     long Ranging(int sys);

-----------------------------------------------------------------------

Quanto ao produto comercial...

Can I build a commercial product based on Arduino?

Yes, with the following conditions:

  • Physically embedding an Arduino board inside a commercial product does not require you to disclose or open-source any information about its design.
  • Deriving the design of a commercial product from the Eagle files for an Arduino board requires you to release the modified files under the same Creative Commons Attribution Share-Alike license. You may manufacture and sell the resulting product.
  • Using the Arduino core and libraries for the firmware of a commercial product does not require you to release the source code for the firmware. The LGPL does, however, require you to make available object files that allow for the relinking of the firmware against updated versions of the Arduino core and libraries. Any modifications to the core and libraries must be released under the LGPL.
  • The source code for the Arduino environment is covered by the GPL, which requires any modifications to be open-sourced under the same license. It does not prevent the sale of derivative software or its inclusion in commercial products.

In all cases, the exact requirements are determined by the applicable license. Additionally, see the previous question for information about the use of the name “Arduino”.

arduino.cc

 

RSS

© 2024   Criado por Marcelo Rodrigues.   Ativado por

Badges  |  Relatar um incidente  |  Termos de serviço