ESCADA INTELIGENTE COM ARDUINO MEGA

Estou querendo fazer um projeto com o Arduino Mega,Irei Utilizar 2 Sensores Ultrassonicos e um Modulo rele com 8 Reles,pois irei acionar lâmpadas na escada ao invés de leds,já fiz a programação mas a mesma não funciona,eu fiz algumas modificações nela,pois antes ela estava acionando todos os reles ao mesmo tempo,agora o arduino não quer nem compilar,se puderem me ajudar agradeço muito.

// Escada Inteligente//

#include "Arduino.h"
#include "NewPing.h"

#define SONAR_NUM 2 // Numero de Sensores.
#define MAX_DISTANCE 50 // Distancia Maxima em cm.
#define PING_INTERVAL 33 // Tempo de Leitura de cada sensor.

unsigned long pingTimer[SONAR_NUM]; // Determina o tempo que cada leitura deve acontecer.
unsigned int cm[SONAR_NUM]; // Onde são armazenadas as distancias
uint8_t currentSensor = 0; // Mantém armazenado qual sensor está ativo.

const int Pinoled1 = 11; //led 1
const int Pinoled2 = 12; //led 2
const int Pinoled3 = 13; //led 3
const int Pinoled4 = 14; //led 4
const int Pinoled5 = 15; //led 5
const int Pinoled6 = 16; //led 6
const int Pinoled7 = 17; //led 7
const int Pinoled8 = 18; //led 8
int sensor1 = 0;
int sensor2 = 0;

NewPing sonar[SONAR_NUM] =
{
NewPing(50, 51, MAX_DISTANCE),
NewPing(24, 26, MAX_DISTANCE),

};

void setup() {
Serial.begin(9600);
pingTimer[0] = millis() + 75; // Primeiro ping começa em 75ms.
for (uint8_t i = 1; i < SONAR_NUM; i++) // Defina a hora de início para cada sensor.
pingTimer = pingTimer[i - 1] + PING_INTERVAL;

  • pinMode (Pinoled1,OUTPUT);*
  • pinMode (Pinoled2,OUTPUT);*
  • pinMode (Pinoled3,OUTPUT);*
  • pinMode (Pinoled4,OUTPUT);*
  • pinMode (Pinoled5,OUTPUT);*
  • pinMode (Pinoled6,OUTPUT);*
  • pinMode (Pinoled7,OUTPUT);*
  • pinMode (Pinoled8,OUTPUT);*

}
void loop() {

  • for (uint8_t i = 0; i < SONAR_NUM; i++) { // Loop through all the sensors.*
    _ if (millis() >= pingTimer*) { // Is it this sensor's time to ping?_
    pingTimer += PING_INTERVAL * SONAR_NUM; // Set next time this sensor will be pinged.
    if (i == 0 && currentSensor == SONAR_NUM - 1) oneSensorCycle(); // Sensor ping cycle complete, do something with the results.
    sonar[currentSensor].timer_stop(); // Make sure previous timer is canceled before starting a new ping (insurance).
    _ currentSensor = i; // Sensor being accessed.
    cm[currentSensor] = 0; // Make distance zero in case there's no ping echo for this sensor._
    sonar[currentSensor].ping_timer(echoCheck); // Do the ping (processing continues, interrupt will call echoCheck to look for echo).
    _ }
    }
    if(sensor1=HIGH)||(sensor2=HIGH)
    {
    acionamento()=1;
    }
    }
    void echoCheck() { // If ping received, set the sensor distance to array._

    if (sonar[currentSensor].check_timer())
    cm[currentSensor] = sonar[currentSensor].ping_result / US_ROUNDTRIP_CM;
    _}
    void oneSensorCycle() { // Sensor ping cycle complete, do something with the results.
    // The following code would be replaced with your code that does something with the ping results.*_

* for (uint8_t i = 0; i < SONAR_NUM; i++) {
_ Serial.print(i);
Serial.print("=");
Serial.print(cm);
Serial.print("cm ");
}
Serial.println();
}
void acionamento()
{
if(cm[0] > 1 && cm[0] < 50)
{
digitalWrite(Pinoled1,HIGH);*_

* digitalWrite(Pinoled2,HIGH);*

* digitalWrite(Pinoled3,HIGH);*

* digitalWrite(Pinoled4,HIGH);*

* digitalWrite(Pinoled5,HIGH);*

* digitalWrite(Pinoled6,HIGH);*

* digitalWrite(Pinoled7,HIGH);*

* digitalWrite(Pinoled8,HIGH);*

* }*
* if(cm[0])*
* {*
* digitalWrite(Pinoled1,LOW);*

* digitalWrite(Pinoled2,LOW);*

* digitalWrite(Pinoled3,LOW);*

* digitalWrite(Pinoled4,LOW);*

* digitalWrite(Pinoled5,LOW);*

* digitalWrite(Pinoled6,LOW);*

* digitalWrite(Pinoled7,LOW);*

* digitalWrite(Pinoled8,LOW);*

* }*
* }*

Bem-vindo ao fórum LucasST. Antes de postar deve ria ter lido as regras. Há uma forma de postar código para que se consiga ver melhor e não ocupe tanto espaço na mensagem.
Em relação ao seu problema, poderia postar o código original? Pelo que estou a ver está a misturar arrays com variáveis simples e por isso é que não está a compilar.