so heres my code now, i removed the libraries and included again:
// This #include statement was automatically added by the Particle IDE.
#include "blynk/blynk.h"
char auth[] = "blabla";
const int relay1 = A0;
const int sensor1 = A1;
void setup()
{
Serial.begin(9600);
delay(1000);
Blynk.begin(auth);
pinMode(relay1, OUTPUT);
pinMode(sensor1, INPUT);
Particle.function("luz1", luz_state);
}
void loop()
{
Blynk.run();
static boolean lastSensorHit = false;
static boolean relayValue = LOW;
int sensorValue = map(analogRead(sensor1), 0, 4095, 0 , 200);
bool sensorHit = sensorValue > 0 && sensorValue <200;
if (sensorHit && !lastSensorHit)
{
relayValue = !relayValue;
digitalWrite(relay1, relayValue);
}
lastSensorHit = sensorHit;
}
{ // <-- this is wrong
int luz_state(String command)
{
if (command=="on")
{
digitalWrite(relay1,HIGH);
return 1;
}
else if (command=="off")
{
digitalWrite(relay1,LOW);
return 0;
}
else
{
return -1;
}
}
} // <-- this is wrong too
and heres the errors:
In file included from blynk/BlynkParticle.h:16:0,
from blynk/BlynkSimpleParticle.h:14,
from blynk/blynk.h:2,
from 01_particle.cpp:2:
blynk/BlynkApiParticle.h:78:6: warning: #warning "analogInputToDigitalPin not defined => Named analog pins will not work" [-Wcpp]
#warning "analogInputToDigitalPin not defined => Named analog pins will not work"
^
01_particle.cpp:44:1: error: expected unqualified-id before '{' token
digitalWrite(relay1, relayValue);
^
make[1]: *** [../build/target/user/platform-601_particle.o] Error 1
make: *** [user] Error 2