Difference between revisions of "Smart Car Kit for Arduino FAQ"

From Wiki
Jump to: navigation, search
Line 1: Line 1:
 
==Q1: Add bluetooth to Smart car==
 
==Q1: Add bluetooth to Smart car==
'''<font color="red">A:</font>'''<br>
+
'''<font color="red">A:</font>''' You may first test whether the Bluetooth module works or not. Refer to this link: <br>
You may first test whether the Bluetooth module works or not. Refer to this link: <br>
+
 
http://wiki.sunfounder.cc/index.php?title=Bluetooth_4.0_HM-10_Master_Slave_Module <br>
 
http://wiki.sunfounder.cc/index.php?title=Bluetooth_4.0_HM-10_Master_Slave_Module <br>
 
If it works, continue to connect.<br>
 
If it works, continue to connect.<br>

Revision as of 06:03, 2 June 2017

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
    }
   }