expression cannot be used as a function // can someone help me ?

define bomba 13

define SENSOR_NOR 12

define seco 11 //sensor a seco

define normal 10 //reservatorio em nivel normal

define DESLIGADA LOW

define LIGADA HIGH

unsigned char novo(unsigned char novo_estado);

boolean transicao = true;

unsigned int reservatorio = novo(seco);

void setup () {

pinMode(SENSOR_NOR,INPUT_PULLUP); }

void loop () {

boolean max; while (max = SENSOR_NOR);

switch(reservatorio) { case normal: if(true()) { do(bomba,LIGADA); }

if(max) { reservatorio = novo(normal); } break;

case seco: if(true()) { do(bomba,DESLIGADA); }

if(!max) { reservatorio = novo(seco); } break; } }

Nearly every single line of that is an error. You can’t just make syntax up as you go. You need to take a look at some examples for the Arduino and familiarize yourself with how Arduino code is written and what functions and commands are available.

  nor = sensor_nor();What does this line of code do ?

What is the program supposed to do ?

Why is this code just floating around.

switch(reservatorio) {
   case normal
   if(houve_transicao()) {
   bomba(LIGADA);
   }

   if(nor) {
   reservatorio = novo(normal);
   }
   break;

   case seco:
   if(houve_transicao()) {
   bomba(DESLIGADA);
   }

   if(!nor) {
   reservatorio = novo(seco);
   }
   break;
   }

You need to try compiling it and fix some of the more obvious errors like things that simply haven't been defined anywhere and daft spelling mistakes like PinMode instead pinMode.

Then you can post the updated program and if it still doesn't compile also post a complete error listing.

You also need to post your question only once...multiple postings are against the forum rules and irritates people who might have helped you.

Steve

@gabrieldamakampos

DO NOT CROSS POST ! It wastes peoples time and efforts to help you. Topics MERGED

Please also READ HERE before continuing to use the forum.

Bob.

I got it to compile! I only had to change a few dozen lines. :)

const byte BombaPin = 13;
const byte SENSOR_NORPin = 12;

const byte Seco = 11;
const byte Normal = 10;
const byte Vazio = 9;

#define DESLIGADA LOW
#define LIGADA HIGH

unsigned char novo(unsigned char novo_estado)
{
  return novo_estado;
}

boolean Transicao = true;

unsigned int reservatorio = novo(Vazio);

void setup ()
{
  pinMode(SENSOR_NORPin, INPUT_PULLUP);
  pinMode(BombaPin, OUTPUT);
}

void loop ()
{
  boolean nor = digitalRead(SENSOR_NORPin);

  switch (reservatorio)
  {
    case Normal:
      if (houve_transicao())
      {
        digitalWrite(BombaPin, LIGADA);
      }

      if (nor)
      {
        reservatorio = novo(Normal);
      }
      break;

    case Seco:
      if (houve_transicao())
      {
        digitalWrite(BombaPin, DESLIGADA);
      }

      if (!nor)
      {
        reservatorio = novo(Seco);
      }
      break;
  }
}

boolean houve_transicao()
{
  return false;
}