Hi everybody!
I have an Events Board and I am trying to get a PIR sensor, temperature sensor, and humidity sensor to communicate with the Android Wifi application. However, using the code below, the Android application only displays a value of 0 for these sensors (the rest are dummy test values). I've tested using the Smart Cities board and it worked out fine, but I know that there are coding differences for the Events Board. What am I doing wrong here?

Code:
// Specifies the message that is sent to the WiFi module.
char tosend[128];
char sTem[12];
char sLum[12];
char sPir[12];
void setup(){
// Initialize the accelerometer
ACC.begin();
ACC.setMode(ACC_ON);
SensorEvent.setBoardMode(SENS_ON);
RTC.ON();
SensorEvent.setThreshold(SENS_SOCKET3, 2);
SensorEvent.setThreshold(SENS_SOCKET5, 2);
SensorEvent.setThreshold(SENS_SOCKET7, 0.5);
WIFI.begin();
// Then switch on the WIFI module on the desired socket.
WIFI.ON(socket0);
// If we don't know what configuration had the module, reset it.
WIFI.resetValues();
// 1. Configure the transport protocol (UDP, TCP, FTP, HTTP...)
WIFI.setConnectionOptions(UDP);
// 2. Configure the way the modules will resolve the IP address.
WIFI.setDHCPoptions(DHCP_ON);
}
void loop(){
// 3. Configure how to connect the AP.
WIFI.setJoinMode(MANUAL);
float temperature;
//float humidity;
float luminosity;
float pir;
//Enable interruptions from the board
SensorEvent.attachInt();
//Put the mote to sleep
//PWR.sleep(UART0_OFF | UART1_OFF | BAT_OFF | RTC_OFF);
//Disable interruptions from the board
SensorEvent.detachInt();
//Load the interruption register
SensorEvent.loadInt();
//Compare the interruption received with the sensor identifier
//if (SensorEvent.intFlag & SENS_SOCKET7)
//{
while(1){
// 3.1 Call join giving the name of the AP.
while(!WIFI.join("ANDROID")){}
// Switches on green led to show us it's connected.
Utils.setLED(LED0, LED_ON);
// 4. Creates UDP connection.
if (WIFI.setUDPclient("255.255.255.255",12345,2000))
{
// 5. Now we can use send and read functions to send and
// receive UDP messages.
while(1){
// 6. Send data to the IOS smartphone
temperature = SensorCities.readValue(SENS_SOCKET5);
Utils.float2String(temperature,sTem,2);
luminosity = SensorCities.readValue(SENS_SOCKET3);
Utils.float2String(luminosity,sLum,2);
pir = SensorEvent.readValue(SENS_SOCKET7);
Utils.float2String(pir,sPir,2);
sprintf(tosend,"Wasp-1;%s;%d;%s;22;23;%s;%d;%d;%d;",sTem,10,sLum,sPir,ACC.getX(),ACC.getY(),ACC.getZ());
// sprintf(tosend,"Wasp-1;%f;%f;%f;22;23;24;%d;%d;%d;",
// SensorCities.readValue(SENS_CITIES_TEMPERATURE),SensorCities.readValue(SENS_CITIES_HUMIDITY),SensorCities.readValue(SENS_CITIES_LDR),ACC.getX(),ACC.getY(),ACC.getZ());
WIFI.send(tosend);
// Reads data to the IOS smartphone
WIFI.read(NOBLO);
// Waspmote acts depending on the answer.
uint8_t period = (WIFI.answer[6] - 48) * 10 + (WIFI.answer[7] - 48);
if (period<11){
// Switches on a lamp with intensity= period %
}
}
}
}
// }
}
Thanks for your help!