Hello,
I have 2 photons up and running, with one publishing events, and the other subscribing to them. Everything works fine until I add the PRIVATE / MY_DEVICES parameters, respectively. The active parts of my code are show below. If you see something wrong, your help would be greatly appreciated!
PUBLISHING DEVICE CODE:
double voltage = 0;
double waterlevel = 0;
void setup() {
pinMode(A0, INPUT);
}
void loop() {
voltage = analogRead(A0);
waterlevel = voltage / 220;
Particle.publish("WaterLevelPublish", String(waterlevel), PRIVATE);
delay(30000);
}
SUBSCRIBING DEVICE CODE
int water_level_int = 0;
Adafruit_8x8matrix matrix;
void myHandler(const char *event, const char *data)
{
std::string num = data;
double temp = ::atof(num.c_str());
water_level_int = (int)temp;
}
void setup() {
Serial.begin(9600);
Serial.println("8x8 LED Matrix Test");
matrix.begin(0x70);
Particle.subscribe("WaterLevelPublish", myHandler, MY_DEVICES);
}
void loop() {
// This loop blinks an 8x8 LED matrix based on the value of water_level_int
}