This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/LAUNCHXL-CC2640R2: how to control motors using l293d motor driver via bluetooth android app

Part Number: LAUNCHXL-CC2640R2
Other Parts Discussed in Thread: CC2640, L293D, ENERGIA

Tool/software: Code Composer Studio

Hi,

I have LAUNCHXL-CC2640R2

I have implemented project zero with BLE Scanner and able to control on board LEDs

I want to make a Bluetooth controlled car such that wwhen I enter 1 on Android app, it should get transmitted via bluetooth to CC2640 and start moving the motors and simalarly for left and right

Now, I want to connect L293D motor driver to control 2 small DC motors and HCSR04 Ultrasonic sensor.

After searching a lot, I am still not getting how to interface Motor driver and sensor with CC2640R2.  I am familier with MSP430 interface with Energia.

I am new to CCS ( since CC2640R2 does not support Energia)

Following are my issues

1) How to initialize GPIO pins for CC2640 to connect motor driver in CCS

2) How to modify the CCS code for project zero and add motor driver code

3) where can i find source code for android app ( I want to integrate this functionality in a custom Android app with other features)

  • You can refer to pin interrupt example at dev.ti.com/.../node
  • Hey,

    Thanks for your reply.

    After searching a lot, I finally implemented the app.

    Following is the code snippet to initialize GPIO pins :

    //project_zero.c

    static PIN_Handle motorPinHandle;

    static PIN_State motorPinState;

    PIN_Config motorPinTable[] = {

     Board_motor1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,

     Board_motor11 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,

     Board_motor1E | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX,

     Board_motor2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,

     Board_motor22 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,

     Board_motor2E | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX,

     PIN_TERMINATE

    };

     //open motor pins

     motorPinHandle = PIN_open(&motorPinState, motorPinTable);

     if(!motorPinHandle) {

       Log_error0("Error initializing board motor pins");

       Task_exit();

     }