home automation

void setup() {
// put your setup code here, to run once:

}

void loop() {
// put your main code here, to run repeatedly:

}
void setup() {
Serial.begin(9600);
}

void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
delay(500);
}
/*
AnalogReadSerial 23/02/2015

Este sketch lee una entrada analógica en el pin 0 (A0)
imprime el resultado en el monitor serial. Usaremos
el medidor de humedad en suelo FC-28
Conexiones:
VCC a 5V
GND a GND
A0 a A0
Do lo reservamos para mas adelante activar la bomba de agua.

Este sketch es para usuarios de www.arduino.cc ;D
*/

float sensorHumedad; // Variable sensor humedad

void setup() {
// iniciamos el pin 13 como salida
pinMode(13, OUTPUT);
// iniciamos la comunicación serial a 9600 bits por segundo:
Serial.begin(9600);
}

void loop() { // Esta función se mantiene...

sensorHumedad = analogRead(A0); // leemos la entrada analógica en pin 0:
sensorHumedad = 5-5sensorHumedad/1023; // convertimos el valor
Serial.print(sensorHumedad); // visualizamos el valor leído y sin salto de linea...
Serial.print("V, "); // Imprimo los V para ver la relación en pantalla
sensorHumedad=sensorHumedad
20; // Multiplico los 5V * 20 para que 1023 me de 100%
Serial.print(sensorHumedad); // y lo mostramos
Serial.println ("%"); // ...Ponemos el símbolo de la Humedad
delay(500); // retardo de medio segundo entre lecturas por estabilidad

if (sensorHumedad<=50) // si el sensor da lectura de menos de 50%
{
digitalWrite(13, HIGH); // encendemos el led
}
else // no añadimos nada porque si no es menor es mayor
{
digitalWrite(13, LOW); // apagamos el led
}
}
/*
Relé activado por sensor de humedad en tierra

Este sketch lee una entrada analógica en el pin 0 (A0)
imprime el resultado en el monitor serial. Usaremos
el medidor de humedad en suelo FC-28
Conexiones:

Please READ THIS POST to help you get the best out of the forum.

SIMPLE TROUBLESHOOTING.

These steps may also save you some unnecessary time and effort in the forum.

  • Always provide as much detail as possible to your issue it may be important.
  • If applicable provide your SKETCH inside CODE TAGS ( </> ) or a CREATE share link.
  • If applicable provide a schematic even if hand drawn.
  • How to insert a picture into your post
  • If applicable provide a proper LINK to the hardware / sensors etc. you are using.

COMMON ISSUES

  • Check you have a COMMON GROUND where required.
  • Where possible use USB 2.0 ports or a USB 2.0 POWERED HUB to rule out USB 3.0 issues.
  • Try other computers where possible.
  • Try other USB leads where possible.
  • You may not have the correct driver installed. CH340/341 or CP2102
  • There may be a problem with the board check your wiring first.
  • Remove any items connected to pins 0 and 1.

COMPUTER RELATED

  • close any other serial programs before opening the IDE.
  • Ensure you turn off any additional security / antivirus just to test.
  • There may be a problem with the PC try RESTARTING it.
  • You may be selecting the wrong COM port.
  • Avoid cloud/network based installations where possible OR ensure your Network/Cloud software is RUNNING.
  • Clear your browsers CACHE.
  • Close the IDE before using any other serial programs.
  • Preferably install IDE's as ADMINISTRATOR or your OS equivalent

Arduino specific boards

Language problem ?
Try a language closer to your native language:

Performing the above actions may help resolve your problem without further help.
Thanks to all those who helped and added to this list.
Bob.