problem is my torque converter locked up (peugeot 308 engine stall and died at signal & shudder at highway driving)

Thursday After work the way home I experence My car go to limphome mode and stuck to 3rd gear and I could not drove more then 80k and RPM was like 5000 with diesel engine, .......
bad simptom was started 2month ago it was not seriouse, and now I think problem is my torque converter locked up (peugeot 308 engine stall and died at signal & shudder at highway driving) because only I think of engine stall at stop, is clucth locked up in this case is torque converter and when highway driving about 5th or 6th gear seems shuddeing like engaging disengaging problem I thought my self maybe oil problem, but now I thinking this is the proplem'
TCC valve / solenoid.

My peugeot has Aisin AM6 auto transmission. when I search the parts I found that also called TF80SC.
other manufactur use same Aisin Transmission but different name on it.

Common Complaints with AW 6 Speed FWD

Complaint:
  • Harsh up or downshifts
  • TCC slip, fluid overheat
  • RPM cycling at low speed or coast
Cause:
  • TCC clutch is not releasing or loss of TC modulation control
  • Torque converter clutch control valve bore worn and/or secondary regulator valve bore worn
Diagnostic Procedure:
  • Monitor converter release pressure to verify the clutch is being controlled. If release psi remains low (see chart) during up/down shift, the control valve is not stroking. Compare the release pressure to TCC solenoid amperage. For overheated conditions, also monitor cooler flow (see chart).

and I suspect and I hope is valve solenoid it self not valve body or valve worn otherwise it has to change all valve body.
so I give it shot 
I bought this 
Postage:
FREE Expedited Shipping from China/Hong Kong/Taiwan to worldwide See details
Item location:
Hongkong, Hong Kong
Posts to:
Australia, Americas, Europe, Asia See exclusions
Delivery:

TF80-SC 8Pcs/Set Transmission Valve Solenoids Replacement Fit for C30/C30R 10-11


Feature:
1. Constructed of high quality iron material for maximum durability.
2. OE part number for reference: TF80-SC, TF81-SC, TF80SC, TF81SC.
3. Professional manufacturing, high precision and long durability.
4. Easy to install, you can directly replace old or damaged parts
5. Particularly fit for C30/C30R 10-11 2.4L.
Specification:
Condition: 100% Brand New
Item Type: Transmission Solenoids
Material: Iron
Color: As Pictures Shown
Manufacturer Part Number: TF80-SC, TF81-SC, TF80SC, TF81SC
Fitment:
Fit for C30/C30 R 10-11 2.4L
Fit for C70 10-11 2.4L
Fit for S/V60 05-11 L4 2.0L 2.4L V6 3.0L 3.2L
Fit for S80 06-11 2.0L L5 2.4L 2.5L V6 3.0L 3.2L V8 4.4L
Fit for V70 01-11 L5 2.4L 2.5L V6 3.2L
Fit for XC60 08-11 2.0L L5 2.4L V6 3.0L 3.2L
Fit for XC70 07-11 2.4L V6 3.0L 3.2L
Fit for XC90 05-11 2.4L V6 3.2L V8 4.4L
Fit for ALFA ROMEO
Fit for 159 06-10 1.9L 2.0L L5 2.4L V6 3.2L
Fit for BRERA 05-10 3.2L
Fit for SPIDER 06-10 3.2L
Fit for CITROEN
Fit for C4/C4 PICASSO 06-11 1.7L 2.0L
Fit for C5 04-11 2.2L V6 2.7L 2.9L 3.0L
Fit for C6 02-11 2.7L 2.9L 3.0L
Fit for C8 05-08 2.2L V6 2.9L
Fit for FIAT
Fit for CROMA 05-11 1.9L L5 2.4L
Fit for ULYSSE 08-10 2.2L
Fit for Lancia
Fit for DELTA 09-11 1.8L
Fit for PHEDRA 08-11 2.2L
Fit for THSIS 05-09 2.4L
Fit for OPEL/VAUXHALL
Fit for ASTRA 06-11 1.9L
Fit for INSIGNIA 08-11 2.0L 2.8L
Fit for SIGNUM 05-08 1.9L 2.8L 3.0L
Fit for VECTRA 05-08 1.9L V6 2.8L 3.0L
Fit for ZAFIRA 05-11 1.9L 2.0L
Fit for PEUGEOT
Fit for 307 06-08 2.0L
Fit for 308 07-11 2.0L
Fit for 407 06-11 2.0L V6 2.7L 2.9L 3.0L
Fit for 607 04-10 2.7L 2.9L
Fit for 807 06-10 2.2L
Fit for 3008 09-11 2.0L
Fit for 5008 09-11 2.0L
Fit for RENAULT
Fit for ESPACE 06-11 3.0L
Fit for VEL SATIS 05-09 3.0L
Fit for SAAB
Fit for 9'3 06-11 1.9L 2.0L V6 2.8L
Fit for 9'5 10-11 2.0L V6 2.8L

Package List:
8Pcs/Set x Transmission Solenoids

Wiring diagram for Ford Falcon BA to make start car using smartphone project.
















please test relay module before installation.

Immobilizer need key to start engine.   not recommand to work on immobilizer like I did. Can cause starting problem. (please be caution work on Immobilizer.)

Every car is special


I work for auto industry for many years as technician I feel some uncomfortable about some gaps between luxury and just normal brand reasonable priced car.

when I see the luxury brand,  that make me feels like I am fall behind because I can not afford to buy car which has so many advanced functions and expensive and secret tech they do not want to share.
(And Actually I still want to have Luxury car..)

they may want to distinguished from average and  looks special.

I respect and understand luxury auto markets


But, I think even normal reasonable price old car can be special, unique, important.

regardless of price, brand, model or old or new.

Every car is unique and special.


So I want add some special features on my car that make my car more unique and make me happy.


I believe My car can be different and is special then any other luxury brand car.

Arduino source code for Autoconnection app controller (Hyundai i30 ver)

Arduino source code for Autoconnection app controller (Hyundai i30 ver)
Please upload to arduino

//open arduino uno
//and upload below code.
//Hyundia i30 ver


//copy and paste from here
// made by joe jo

#include <TimerOne.h>
#include <avr/interrupt.h>

String data = "0";            //Variable for storing received data
int analogInput = A0;
float Vout = 0.00;
float Vin = 0.00;
float R1 = 100000.00; // resistance of R1 (100K)
float R2 = 10000.00; // resistance of R2 (10K)
int val = 0; // voltage input
int igset = 0;
String password = "0000";

boolean function1_status = false;
boolean function2_status = false;
boolean function1_check = false;
boolean function2_check = false;


//pins numbers
int doorstatus_pin = 2; //door status input pin
int door_unlock = 3;
int door_lock = 4;

int ig_acc = 5;
int ig_on = 6;
int ig_on_start = 7;
int ig_start = 8;

int function1 = 9;
int function2 = 10;

int board_led = 13;


void Wait()
{
   uint8_t i=0;
   for(;i<23;i++)
      _delay_loop_2(0);
}


void callback()
{
  val = analogRead(analogInput);//reads the analog input
   Vout = (val * 5.00) / 1024.00; // formula for calculating voltage out i.e. V+, here 5.00
   Vin = (Vout / (R2/(R1+R2)))+0.2; // formula for calculating voltage in i.e. GND
   if (Vin<0.09)//condition
   {
     Vin=0.00;//statement to quash undesired reading !
  }

Serial.print(" ");
Serial.print(Vin);
Serial.println("V");//voltage
Serial.println("\n");
Serial.println("\n");

door_status();
ig_status();
function1_stat();
function2_stat();
}


void setup()
{
    Serial.begin(9600);   //Sets the baud for serial data transmission                           
    pinMode(board_led, OUTPUT);  //Sets digital pin 13 as output pin
    //pinMode(2, INPUT);  //Sets digital pin 2 as Input pin
    pinMode(doorstatus_pin, INPUT_PULLUP); //normally input is pull down status
    //attachInterrupt(digitalPinToInterrupt(doorstatus_pin), door_status, CHANGE); //disabled this time because too sensitive and cause too much inturrubt
    pinMode(analogInput, INPUT); //assigning the input port

    pinMode(door_unlock, OUTPUT);
    pinMode(ig_acc, OUTPUT);
    pinMode(ig_on, OUTPUT);
    pinMode(ig_on_start, OUTPUT);
    pinMode(ig_start, OUTPUT);
    pinMode(door_lock, OUTPUT);
    pinMode(function1, OUTPUT);
    pinMode(function2, OUTPUT);

    digitalWrite(door_unlock, HIGH);
    digitalWrite(ig_acc, HIGH);
    digitalWrite(ig_on, HIGH);
    digitalWrite(ig_on_start, HIGH);
    digitalWrite(ig_start, HIGH);
    digitalWrite(door_lock, HIGH);
    digitalWrite(function1, HIGH);
    digitalWrite(function2, HIGH);

 Timer1.initialize(1000000*3);         // initialize timer1, and set a 1/2 second period
  //Timer1.pwm(9, 512);                // setup pwm on pin 9, 50% duty cycle
  Timer1.attachInterrupt(callback);  // attaches callback() as a timer overflow interrupt

}

void function1_stat()
{
  if (function1_status == true){Serial.println(" f1o");}
  if (function1_status == false){Serial.println(" f1f");}
}

void function2_stat()
{
  if (function2_status == true){Serial.println(" f2o");}
  if (function2_status == false){Serial.println(" f2f");}
}


void ig_status()
{
  switch (igset){
    case (0) : Serial.println(" i0");  break;
    case (1) : Serial.println(" i1");  break;
    case (2) : Serial.println(" i2"); break;
    case (3) : Serial.println(" i3");  break;
  }
}
void igup()
{
  igset = igset + 1;

    if (igset >= 3)
    {
      igset = 3;
    }

    igsetup();
}

//we call IG up
void igdown()
{
  igset = igset - 1;

    if (igset <= 0)
    {
      igset = 0;
    }
    igsetup();
}

void igsetup()
{

    switch (igset){
    case (0) : igoff_f(); break;
    case (1) : igacc_f(); break;
    case (2) : igon_f(); break;
    case (3) : igstart_f(); break;

  }
}
void igoff_f()
{igset = 0;

    digitalWrite(ig_acc, HIGH);
    digitalWrite(ig_on, HIGH);
    digitalWrite(ig_on_start, HIGH);
    digitalWrite(ig_start, HIGH);
    digitalWrite(board_led, LOW);
    ig_status();
}

void igacc_f()
{
  igset = 1;


    digitalWrite(ig_acc, LOW);
    digitalWrite(ig_on, HIGH);
    digitalWrite(ig_on_start, HIGH); 
    digitalWrite(ig_start, HIGH);
    ig_status();
}
void igon_f()
{
  igset = 2;


    digitalWrite(ig_acc, LOW);
    digitalWrite(ig_on, LOW);
    digitalWrite(ig_on_start, LOW);
    digitalWrite(ig_start, HIGH);
    ig_status();
}

void igstart_f()
{
igset = 3;
//noInterrupts();
    digitalWrite(ig_acc, HIGH);
    digitalWrite(ig_on, LOW);
    digitalWrite(ig_on_start, HIGH); 
    digitalWrite(ig_start, LOW);
    ig_status();
     delay(1000*3); igon_f();
          // interrupts();

}
void door_status()
{
    noInterrupts();
  // critical, time-sensitive code here

             if (digitalRead(doorstatus_pin) == HIGH)
             {Serial.println(" dl");}
             else
             {Serial.println(" du");}//only when grounded
                   interrupts();
              delay(10); //for switching effect

  // other code here     
}

void autounlock()
{

             if (digitalRead(doorstatus_pin) == HIGH)
             {Serial.println(" dl");
             digitalWrite(door_unlock, LOW);
             delay(100);
             digitalWrite(door_unlock, HIGH);
             digitalWrite(board_led, LOW);
             }
             else
             {Serial.println(" du");}//only when grounded
              delay(100); //for switching effect

}

void door_unlock_f()
{

             digitalWrite(door_unlock, LOW);
             delay(100);
             digitalWrite(door_unlock, HIGH);
             digitalWrite(board_led, LOW);

}

void door_lock_f()
{

             digitalWrite(door_lock, LOW);
             delay(100);
             digitalWrite(door_lock, HIGH);
             digitalWrite(board_led, LOW);

}

void function1_f()
{
  if (function1_status == false){ digitalWrite(function1, LOW); function1_check = true;}
  if (function1_status == true){ digitalWrite(function1, HIGH); function1_check = false;}

  if (function1_check == true){function1_status = true;}
  if (function1_check == false){function1_status = false;}
  function1_stat();
}

void function2_f()
{
  if (function2_status == false){ digitalWrite(function2, LOW); function2_check = true;}
  if (function2_status == true){ digitalWrite(function2, HIGH); function2_check = false;}

  if (function2_check == true){function2_status = true;}
  if (function2_check == false){function2_status = false;}
  function2_stat();
}


void loop()
{
     
   if(Serial.available() > 0)      // Send data only when you receive data:

   {
      data = Serial.readString();        //Read the incoming data & store into data
 
      Serial.print(data);          //Print Value inside data in Serial monitor
      Serial.print("\n");

      if(data.startsWith(password) && (data.charAt(4) == '%'))// chartAT(start from'0')   

          {
           digitalWrite(13, HIGH);   //If value is 1 then LED turns ON
          // Serial.println("matched password");
           if (data.endsWith("x") && (data.charAt(5) == '1'))
           {
            if (igset == 0){  autounlock();}     
           }
           if (data.endsWith("x") && (data.charAt(6) == '1'))
           {
            if (igset == 0){
             igset = 3;
             igsetup(); }
           
           }
           if (data.endsWith("x") && (data.charAt(7) == '1'))
           {
             if (igset == 0){ function1_f(); }       
           }
           if (data.endsWith("lockon"))
           {
             door_lock_f();
             door_status();
             ig_status();         
           }
           else if (data.endsWith("lockoff"))
           {
             door_unlock_f();
             door_status();
             ig_status(); 
           }
           else if (data.endsWith("func1"))
           {
             function1_f();
           }
           else if (data.endsWith("func2"))
           {
             function2_f();
           }
           else if (data.endsWith("status"))
           {
            door_status();
            ig_status();
           }
           else if (data.endsWith("igup"))
           {
            igup();
           }
           else if (data.endsWith("igdown"))
           {
       
            igdown();
           }
     
          }
      else if(data.startsWith(password) && (data.charAt(4) == '$'))
          {
            Serial.println(" sa");
            password[0] = data.charAt(5);
            password[1] = data.charAt(6);
            password[2] = data.charAt(7);
            password[3] = data.charAt(8);
          }

      else
      {
        Serial.println(" wr");//wrong password
         digitalWrite(13, LOW);
      }
  }


}

Arduino source code for Autoconnection app controller (toyota landcruiser/prado ver)

Arduino source code for Autoconnection app controller (toyota landcruiser/prado ver)


//open arduino uno
//and upload below code.
//toyota landcruiser/prado ver

//copy and paste from here
// made by joe jo

#include <TimerOne.h>
#include <avr/interrupt.h>

String data = "0";            //Variable for storing received data
int analogInput = A0;
float Vout = 0.00;
float Vin = 0.00;
float R1 = 100000.00; // resistance of R1 (100K)
float R2 = 10000.00; // resistance of R2 (10K)
int val = 0; // voltage input
int igset = 0;
String password = "0000";

boolean function1_status = false;
boolean function2_status = false;
boolean function1_check = false;
boolean function2_check = false;


//pins numbers
int doorstatus_pin = 2; //door status input pin
int door_unlock = 3;
int door_lock = 4;

int ig_acc = 5;
int ig_on = 6;
int ig_on_start = 7;
int ig_start = 8;

int function1 = 9;
int function2 = 10;

int board_led = 13;


void Wait()
{
   uint8_t i=0;
   for(;i<23;i++)
      _delay_loop_2(0);
}


void callback()
{
  val = analogRead(analogInput);//reads the analog input
   Vout = (val * 5.00) / 1024.00; // formula for calculating voltage out i.e. V+, here 5.00
   Vin = (Vout / (R2/(R1+R2)))+0.2; // formula for calculating voltage in i.e. GND
   if (Vin<0.09)//condition
   {
     Vin=0.00;//statement to quash undesired reading !
  }

Serial.print(" ");
Serial.print(Vin);
Serial.println("V");//voltage
Serial.println("\n");
Serial.println("\n");

door_status();
ig_status();
function1_stat();
function2_stat();
}


void setup()
{
    Serial.begin(9600);   //Sets the baud for serial data transmission                           
    pinMode(board_led, OUTPUT);  //Sets digital pin 13 as output pin
    //pinMode(2, INPUT);  //Sets digital pin 2 as Input pin
    pinMode(doorstatus_pin, INPUT_PULLUP); //normally input is pull down status
    //attachInterrupt(digitalPinToInterrupt(doorstatus_pin), door_status, CHANGE); //disabled this time because too sensitive and cause too much inturrubt
    pinMode(analogInput, INPUT); //assigning the input port

    pinMode(door_unlock, OUTPUT);
    pinMode(ig_acc, OUTPUT);
    pinMode(ig_on, OUTPUT);
    pinMode(ig_on_start, OUTPUT);
    pinMode(ig_start, OUTPUT);
    pinMode(door_lock, OUTPUT);
    pinMode(function1, OUTPUT);
    pinMode(function2, OUTPUT);

    digitalWrite(door_unlock, HIGH);
    digitalWrite(ig_acc, HIGH);
    digitalWrite(ig_on, HIGH);
    digitalWrite(ig_on_start, HIGH);
    digitalWrite(ig_start, HIGH);
    digitalWrite(door_lock, HIGH);
    digitalWrite(function1, HIGH);
    digitalWrite(function2, HIGH);

 Timer1.initialize(1000000*3);         // initialize timer1, and set a 1/2 second period
  //Timer1.pwm(9, 512);                // setup pwm on pin 9, 50% duty cycle
  Timer1.attachInterrupt(callback);  // attaches callback() as a timer overflow interrupt

}

void function1_stat()
{
  if (function1_status == true){Serial.println(" f1o");}
  if (function1_status == false){Serial.println(" f1f");}
}

void function2_stat()
{
  if (function2_status == true){Serial.println(" f2o");}
  if (function2_status == false){Serial.println(" f2f");}
}


void ig_status()
{
  switch (igset){
    case (0) : Serial.println(" i0");  break;
    case (1) : Serial.println(" i1");  break;
    case (2) : Serial.println(" i2"); break;
    case (3) : Serial.println(" i3");  break;
  }
}
void igup()
{
  igset = igset + 1;

    if (igset >= 3)
    {
      igset = 3;
    }

    igsetup();
}

//we call IG up
void igdown()
{
  igset = igset - 1;

    if (igset <= 0)
    {
      igset = 0;
    }
    igsetup();
}

void igsetup()
{

    switch (igset){
    case (0) : igoff_f(); break;
    case (1) : igacc_f(); break;
    case (2) : igon_f(); break;
    case (3) : igstart_f(); break;

  }
}
void igoff_f()
{igset = 0;

    digitalWrite(ig_acc, HIGH);
    digitalWrite(ig_on, HIGH);
    digitalWrite(ig_on_start, HIGH);
    digitalWrite(ig_start, HIGH);
    digitalWrite(board_led, LOW);
    ig_status();
}

void igacc_f()
{
  igset = 1;


    digitalWrite(ig_acc, LOW);
    digitalWrite(ig_on, HIGH);
    digitalWrite(ig_on_start, HIGH); 
    digitalWrite(ig_start, HIGH);
    ig_status();
}
void igon_f()
{
  igset = 2;


    digitalWrite(ig_acc, LOW);
    digitalWrite(ig_on, LOW);
    digitalWrite(ig_on_start, LOW);
    digitalWrite(ig_start, HIGH);
    ig_status();
}

void igstart_f()
{
igset = 3;
//noInterrupts();
    digitalWrite(ig_acc, HIGH);
    digitalWrite(ig_on, LOW);
    digitalWrite(ig_on_start, HIGH); 
    digitalWrite(ig_start, LOW);
    ig_status();
     delay(1000*3); igon_f();
          // interrupts();

}
void door_status()
{
    noInterrupts();
  // critical, time-sensitive code here

             if (digitalRead(doorstatus_pin) == HIGH)
             {Serial.println(" dl");}
             else
             {Serial.println(" du");}//only when grounded
                   interrupts();
              delay(10); //for switching effect

  // other code here     
}

void autounlock()
{

             if (digitalRead(doorstatus_pin) == HIGH)
             {Serial.println(" dl");
             digitalWrite(door_unlock, LOW);
             delay(100);
             digitalWrite(door_unlock, HIGH);
             digitalWrite(board_led, LOW);
             }
             else
             {Serial.println(" du");}//only when grounded
              delay(100); //for switching effect

}

void door_unlock_f()
{

             digitalWrite(door_unlock, LOW);
             delay(100);
             digitalWrite(door_unlock, HIGH);
             digitalWrite(board_led, LOW);

}

void door_lock_f()
{

             digitalWrite(door_lock, LOW);
             delay(100);
             digitalWrite(door_lock, HIGH);
             digitalWrite(board_led, LOW);

}

void function1_f()
{
  if (function1_status == false){ digitalWrite(function1, LOW); function1_check = true;}
  if (function1_status == true){ digitalWrite(function1, HIGH); function1_check = false;}

  if (function1_check == true){function1_status = true;}
  if (function1_check == false){function1_status = false;}
  function1_stat();
}

void function2_f()
{
  if (function2_status == false){ digitalWrite(function2, LOW); function2_check = true;}
  if (function2_status == true){ digitalWrite(function2, HIGH); function2_check = false;}

  if (function2_check == true){function2_status = true;}
  if (function2_check == false){function2_status = false;}
  function2_stat();
}


void loop()
{
     
   if(Serial.available() > 0)      // Send data only when you receive data:

   {
      data = Serial.readString();        //Read the incoming data & store into data
 
      Serial.print(data);          //Print Value inside data in Serial monitor
      Serial.print("\n");

      if(data.startsWith(password) && (data.charAt(4) == '%'))// chartAT(start from'0')   

          {
           digitalWrite(13, HIGH);   //If value is 1 then LED turns ON
          // Serial.println("matched password");
           if (data.endsWith("x") && (data.charAt(5) == '1'))
           {
            if (igset == 0){  autounlock();}     
           }
           if (data.endsWith("x") && (data.charAt(6) == '1'))
           {
            if (igset == 0){
             igset = 3;
             igsetup(); }
           
           }
           if (data.endsWith("x") && (data.charAt(7) == '1'))
           {
             if (igset == 0){ function1_f(); }       
           }
           if (data.endsWith("lockon"))
           {
             door_lock_f();
             door_status();
             ig_status();         
           }
           else if (data.endsWith("lockoff"))
           {
             door_unlock_f();
             door_status();
             ig_status(); 
           }
           else if (data.endsWith("func1"))
           {
             function1_f();
           }
           else if (data.endsWith("func2"))
           {
             function2_f();
           }
           else if (data.endsWith("status"))
           {
            door_status();
            ig_status();
           }
           else if (data.endsWith("igup"))
           {
            igup();
           }
           else if (data.endsWith("igdown"))
           {
       
            igdown();
           }
     
          }
      else if(data.startsWith(password) && (data.charAt(4) == '$'))
          {
            Serial.println(" sa");
            password[0] = data.charAt(5);
            password[1] = data.charAt(6);
            password[2] = data.charAt(7);
            password[3] = data.charAt(8);
          }

      else
      {
        Serial.println(" wr");//wrong password
         digitalWrite(13, LOW);
      }
  }


}

Arduino source code for Autoconnection app controller (ford falcon ver)

Arduino source code for Autoconnection app controller (ford falcon ver)

// Coded by joe jo
//copyright on joe jo.
//copy and paste below codes to arduino

#include <TimerOne.h>
#include <avr/interrupt.h>

String data = "0";            //Variable for storing received data
int analogInput = A0;
float Vout = 0.00;
float Vin = 0.00;
float R1 = 100000.00; // resistance of R1 (100K)
float R2 = 10000.00; // resistance of R2 (10K)
int val = 0;
int doorstatus_pin = 2;
String password = "0000";


int ig_acc = 3;
int ig_on = 4;
int ig_start = 5;
int extra = 6;

int door = 7;
int trunk = 8;
int light = 9;


int igset = 0;

void Wait()
{
   uint8_t i=0;
   for(;i<23;i++)
      _delay_loop_2(0);
}
void callback()
{

   val = analogRead(analogInput);//reads the analog input
   Vout = (val * 5.00) / 1024.00; // formula for calculating voltage out i.e. V+, here 5.00
   Vin = (Vout / (R2/(R1+R2)))+0.27; // formula for calculating voltage in i.e. GND
   if (Vin<0.09)//condition
   {
     Vin=0.00;//statement to quash undesired reading !
  }

Serial.print(" ");
Serial.print(Vin);
Serial.println("V");//voltage
Serial.println("\n");
Serial.println("\n");


door_status();
ig_status();
}
void setup()
{
    Serial.begin(9600);   //Sets the baud for serial data transmission                         
    pinMode(13, OUTPUT);  //Sets digital pin 13 as output pin
    //pinMode(2, INPUT);  //Sets digital pin 2 as Input pin
    pinMode(doorstatus_pin, INPUT_PULLUP); //normally input is pull down status
    //attachInterrupt(digitalPinToInterrupt(doorstatus_pin), door_status, CHANGE);
    pinMode(analogInput, INPUT); //assigning the input port

    pinMode(door, OUTPUT);
    pinMode(ig_acc, OUTPUT);
    pinMode(ig_on, OUTPUT);
    pinMode(ig_start, OUTPUT);
    pinMode(trunk, OUTPUT);
    pinMode(light, OUTPUT);
    pinMode(extra, OUTPUT);

    digitalWrite(door, HIGH);
    digitalWrite(ig_acc, HIGH);
    digitalWrite(ig_on, HIGH);
    digitalWrite(ig_start, HIGH);
    digitalWrite(trunk, HIGH);
    digitalWrite(light, HIGH);
    digitalWrite(extra, HIGH);

  Timer1.initialize(1000000*3);         // initialize timer1, and set a 1/2 second period
  //Timer1.pwm(9, 512);                // setup pwm on pin 9, 50% duty cycle
  Timer1.attachInterrupt(callback);  // attaches callback() as a timer overflow interrupt

}



void ig_status()
{
  switch (igset){
    case (0) : Serial.println(" i0");  break;
    case (1) : Serial.println(" i1");  break;
    case (2) : Serial.println(" i2"); break;
    case (3) : Serial.println(" i3");  break;
  }
}
void igup()
{
  igset = igset + 1;

    if (igset >= 3)
    {
      igset = 3;
    }

    igsetup();
}

//we call IG up
void igdown()
{
  igset = igset - 1;

    if (igset <= 0)
    {
      igset = 0;
    }
    igsetup();
}

void igsetup()
{

    switch (igset){
    case (0) : igoff_f(); break;
    case (1) : igacc_f(); break;
    case (2) : igon_f(); break;
    case (3) : igstart_f(); break;

  }
}
void igoff_f()
{igset = 0;

    digitalWrite(ig_acc, HIGH);
    digitalWrite(ig_on, HIGH);
    digitalWrite(ig_start, HIGH);
    digitalWrite(13, LOW);
    ig_status();
}

void igacc_f()
{
  igset = 1;


    digitalWrite(ig_acc, LOW);
    digitalWrite(ig_on, HIGH);
    digitalWrite(ig_start, HIGH);
    ig_status();
}
void igon_f()
{
  igset = 2;


    digitalWrite(ig_acc, LOW);
    digitalWrite(ig_on, LOW);
    digitalWrite(ig_start, HIGH);
    ig_status();
}

void igstart_f()
{
igset = 3;
//noInterrupts();
    digitalWrite(ig_acc, LOW);
    digitalWrite(ig_on, LOW);
    digitalWrite(ig_start, LOW);
    ig_status();
     delay(1000*3); igon_f();
          // interrupts();

}
void door_status()
{
    noInterrupts();
  // critical, time-sensitive code here

             if (digitalRead(doorstatus_pin) == HIGH)
             {Serial.println(" dl");}
             else
             {Serial.println(" du");}//only when grounded
                   interrupts();
              delay(100); //for switching effect

  // other code here   
}

void autounlock()
{

             if (digitalRead(doorstatus_pin) == HIGH)
             {Serial.println(" dl");
             digitalWrite(door, LOW);
             delay(100);
             digitalWrite(door, HIGH);
             digitalWrite(13, LOW);
             }
             else
             {Serial.println(" du");}//only when grounded
              delay(100); //for switching effect

}

void door_f()
{

             digitalWrite(door, LOW);
             delay(100);
             digitalWrite(door, HIGH);
             digitalWrite(13, LOW);

}


void light_f()
{

             digitalWrite(light, LOW);
             delay(100);
             digitalWrite(light, HIGH);
             digitalWrite(13, LOW);

}

void extra_f()
{

             digitalWrite(extra, LOW);
             delay(100);
             digitalWrite(extra, HIGH);
             digitalWrite(13, LOW);

}


void trunk_f()
{

             digitalWrite(trunk, LOW);
             delay(100);
             digitalWrite(trunk, HIGH);
             digitalWrite(13, LOW);

}
void loop()
{

             
   if(Serial.available() > 0)      // Send data only when you receive data:

   {
      data = Serial.readString();        //Read the incoming data & store into data
 
      Serial.print(data);          //Print Value inside data in Serial monitor
      Serial.print("\n");

      if(data.startsWith(password) && (data.charAt(4) == '%'))// chartAT(start from'0') 

          {
           digitalWrite(13, HIGH);   //If value is 1 then LED turns ON
          // Serial.println("matched password");
           if (data.endsWith("x") && (data.charAt(5) == '1'))
           {
            if (igset == 0){  autounlock();  Serial.println("autounlock");}   
           }
           if (data.endsWith("x") && (data.charAt(6) == '1'))
           {
            if (igset == 0){
             igset = 3;
             igsetup(); Serial.println("autostart");}
           
           }
           if (data.endsWith("x") && (data.charAt(7) == '1'))
           {
             if (igset == 0){ light_f(); Serial.println("autolight"); }     
           }
           if (data.endsWith("door"))
           {
             door_f();
             door_status();
             ig_status();       
           }
           else if (data.endsWith("light"))
           {
             light_f();
           }
           else if (data.endsWith("extra"))
           {
             extra_f();
           }
           else if (data.endsWith("trunk"))
           {
             trunk_f();
           }
           else if (data.endsWith("status"))
           {
            door_status();
            ig_status();
           }
           else if (data.endsWith("igup"))
           {
            igup();
           }
           else if (data.endsWith("igdown"))
           {
       
            igdown();
           }
     
          }
      else if(data.startsWith(password) && (data.charAt(4) == '$'))
          {
            Serial.println(" sa");
            password[0] = data.charAt(5);
            password[1] = data.charAt(6);
            password[2] = data.charAt(7);
            password[3] = data.charAt(8);
          }

      else
      {
        Serial.println(" wr");//wrong password
         digitalWrite(13, LOW);
      }
  }


}

constraint layout learning

 constraint layout learning is fun but sadly I couldn't find the way to fitting layouts to any size of mobile screen.  it is easy to org...