Smart Car Kit for Arduino FAQ

From Wiki
Revision as of 06:02, 2 June 2017 by Root (Talk | contribs)

Jump to: navigation, search

Q1: Add bluetooth to Smart car

A:
You may first test whether the Bluetooth module works or not. Refer to this link:
http://wiki.sunfounder.cc/index.php?title=Bluetooth_4.0_HM-10_Master_Slave_Module
If it works, continue to connect.
If your smart phone runs under Android, just follow the steps in Using SunFounder Uno.
After testing, to control the car by phone you need to write another sketch. Copy the following code to your loop(). But you still need to write these functions in the sketch: Car_forward(), Back(), TurnLeft(), TurnRight(), and CarStop().

//Code start   
 if (Serial.available() > 0) 
  {
    val = Serial.read();
  
    if(val == 'a') 
    {
     Car_forward(); //go forward
    }
    if(val == 'b') ;
    {
      Back(); //backward
    }
    if(val == 'c') 
    {
      TurnLeft(); //turn left
    }
    if(val == 'd') 
    {
      TurnRight(); //turn right
    }
    if(val == 'e') 
    {
      CarStop(); //the car stops
    }
   }