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>''' ''<font color="green">You may first test whether the Bluetooth module works or not. Refer to this link:</font>'' <br>
+
''<font color="green">You may first test whether the Bluetooth module works or not. Refer to this link:</font>'' <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>
 
''<font color="green">If it works, continue to connect.</font>''<br>
 
''<font color="green">If it works, continue to connect.</font>''<br>
If your smart phone runs under Android, just follow the steps in Using SunFounder Uno. <br>
+
'''<font color="red">A:</font>'''If your smart phone runs under Android, just follow the steps in Using SunFounder Uno. <br>
 
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(). <br>
 
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(). <br>
 
<pre>
 
<pre>

Revision as of 06:07, 2 June 2017

Q1: Add bluetooth to Smart car

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.
A: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
    }
   }