Hi Guys ,
Can you help me one more time?
I want to use this sketch to send data to thingspeak see below)
Which code line should i add to do this
[code]
/* Flame Sensor analog example.
Code by Reichenstein7 (thejamerson.com)
For use with a Rain Sensor with an analog out!
To test view the output, point a serial monitor such as Putty at your Arduino.
- If the Sensor Board is completely soaked; "case 0" will be activated and " Flood " will be sent to the serial monitor.
- If the Sensor Board has water droplets on it; "case 1" will be activated and " Rain Warning " will be sent to the serial monitor.
- If the Sensor Board is dry; "case 2" will be activated and " Not Raining " will be sent to the serial monitor.
*/
// lowest and highest sensor readings:
const int sensorMin = 0; // sensor minimum
const int sensorMax = 960; // sensor maximum
void setup() {
// initialize serial communication @ 9600 baud:
Serial.begin(9600);
}
void loop() {
// read the sensor on analog A0:
int sensorReading = analogRead(A0);
// map the sensor range (Six options):
// ex: 'long int map(long int, long int, long int, long int, long int)'
int range = map(sensorReading, sensorMin, sensorMax, 0, 15);
// range value:
switch (range) {
case 0: // Sensor getting wet
Serial.println("15");
break;
case 1: // Sensor getting wet
Serial.println("14");
break;
case 2: // Sensor getting wet
Serial.println("13");
break;
case 3: // Sensor getting wet
Serial.println("12");
break;
case 4: // Sensor getting wet
Serial.println("11");
break;
case 5: // Sensor getting wet
Serial.println("10");
break;
case 6: // Sensor getting wet
Serial.println("9");
break;
case 7: // Sensor getting wet
Serial.println("8");
break;
case 8: // Sensor getting wet
Serial.println("7");
break;
case 9: // Sensor getting wet
Serial.println("6");
break;
case 10: // Sensor getting wet
Serial.println("5");
break;
case 11: // Sensor getting wet
Serial.println("4");
break;
case 12: // Sensor getting wet
Serial.println("3");
break;
case 13: // Sensor getting wet
Serial.println("2");
break;
case 14: // Sensor getting wet
Serial.println("1");
break;
case 15: // Sensor dry - To shut this up delete the " Serial.println("Sec"); " below.
Serial.println("0");
break;
}
delay(2000); // delay between reads
}
[/code]