1. You can now buy finished microcontroller project from us, Check out the Store for the complete list of projects.
  2. Need a custom project, Send us some details about your project. So that we can quote the price for it.

MCU Bluetooth RC Car

Discussion in 'Bluetooth' started by jenelleann, Jan 6, 2011.

  1. jenelleann

    jenelleann New Member

    Likes Received:
    0
    Trophy Points:
    0
    I am a Computer Engineering student trying to complete my final thesis to graduate. My thesis is a MCU based Bluetooth RC Car. The MCU board I purchased is called: The Universal Programmable Robot Controller (UPRC) uses feature rich Z8F082A Zilog Encore! XP Microcontroller Engine and I'm using an EGBT 9830 Bluetooth Module. I have already designed the hardware for the thesis, I am just have extreme trouble with the software because I don't really understand what I am doing and I am a solo thesis person. So can you please help me design the software please.
  2. Binu

    Binu Administrator

    Likes Received:
    147
    Trophy Points:
    63
    Do you want to control the car from mobile or from PC through Bluetooth.
  3. jenelleann

    jenelleann New Member

    Likes Received:
    0
    Trophy Points:
    0
    Mobile phone
  4. jenelleann

    jenelleann New Member

    Likes Received:
    0
    Trophy Points:
    0
    Is any able to help me to design the programs. I need to complete them as soon as possible.
  5. Binu

    Binu Administrator

    Likes Received:
    147
    Trophy Points:
    63
    Then you need to write the application for the mobile.
    Have you decided the mobile phone platform since there are many platforms for mobile such us Android, Symbian, Iphone and more..
  6. jenelleann

    jenelleann New Member

    Likes Received:
    0
    Trophy Points:
    0
    I am using a LG KS360 and not sure what the platform is for that phone? Also I need help with the software for the car also, because I am having troubles with that too. can you please help me?
  7. Binu

    Binu Administrator

    Likes Received:
    147
    Trophy Points:
    63
    It supports Java so you can write the code in J2ME.
    Search the forum, already a user have made this project here in J2me.
  8. jenelleann

    jenelleann New Member

    Likes Received:
    0
    Trophy Points:
    0
    Code

    Is this the code you are talking about:


    import appuifw
    # import the module socket
    import socket
    import e32

    # function that handles the bluetooth connection:
    def bt_connect():
    global sock
    # create a bluetooth socket
    sock=socket.socket(socket.AF_BT,socket.SOCK_STREAM)
    target=''# here you can give the bt address of the other mobile if you know it
    if not target:
    # scan for bluetooth devices
    address,services=socket.bt_discover()
    print "Discovered: %s, %s"%(address,services)
    if len(services)>1:
    choices=services.keys()
    choices.sort()
    # bring up a popup menu and show the available bt devices for selection
    choice=appuifw.popup_menu([unicode(services[x])+": "+x
    for x in choices],u'Choose port:')
    target=(address,services[choices[choice]])
    else:
    target=(address,services.values()[0])
    print "Connecting to "+str(target)
    # connect to the serial port of the PC
    sock.connect(target)
    return sock
    print "OK."

    def recieve():
    data=sock.recv(1)
    if data=="1":
    appuifw.note(u"LED on","info")
    elif data=="0":
    appuifw.note(u"LED off","info")

    def recieve():
    data=sock.recv(2)
    if data=="1":
    appuifw.note(u"Light on","info")
    elif data=="0":
    appuifw.note(u"Light off","info")


    def bt_send_data1():
    bt_connect()
    sock.send("1")
    receive()

    def bt_send_data2():
    bt_connect()
    sock.send("0")
    receive()

    def bt_send_data3():
    bt_connect()
    sock.send("1")
    receive()

    def bt_send_data4():
    bt_connect()
    sock.send("0")
    receive()


    def quit():
    print"socket closed"
    sock.close()
    app_lock.signal()

    app_lock=e32.Ao_lock()

    appuifw.app.menu=[(u"LED on",bt_send_data1),
    (u"LED off",bt_send_data2),
    (u"Light on",bt_send_data3),
    (u"Light off",bt_send_data4),
    (u"Exit", quit]

    appuifw.app.exit_key_handler = quit
    app_lock.wait()


    def exit_key_handler():
    script_lock.signal()
    appuifw.app.set_exit()

    appuifw.app.title = u"Smart home"

    script_lock = e32.Ao_lock()

    appuifw.app.exit_key_handler = exit_key_handler()


    script_lock.wait()
Loading...

Share This Page