PIR Sensor - Bluetooth Communication

Hello everyone! I am new in Arduino world. I wrote a code for PIR sensor. PIR sensor send values to the Serial terminal (and also to terminal of a Android app.). I can see the values when they changes (0 - no motion, 1 - motion) but the LED associate didn't turn on. Can anyone help me please? I am sorry for my bad english! Thank you very much!

This is the code:

int ledPin = 12; // choose the pin for the LED int inputPin = 4; // choose the input pin (for PIR sensor) int pirState = LOW; // we start, assuming no motion detected int val = 0; // variable for reading the pin status String readString;

void setup() { pinMode(ledPin, OUTPUT); // declare LED as output pinMode(inputPin, INPUT); // declare sensor as input

Serial.begin(9600); }

void loop(){

while (Serial.available()){ delay(1000); char text = Serial.read(); readString += text; }

if (readString.length()>0){ Serial.println(readString); if(readString == "1") { digitalWrite (ledPin,HIGH); } if (readString == "0") { digitalWrite (ledPin,LOW); } readString = ""; }

val = digitalRead(inputPin); // read input value digitalWrite (inputPin, val); Serial.print(" "); Serial.println(val);

delay (200);