Shop OBEX P1 Docs P2 Docs Learn Events
Sending a (char/string/etc) via bluetooth from android to propeller using RN42 blu — Parallax Forums

Sending a (char/string/etc) via bluetooth from android to propeller using RN42 blu

TheinternetTheinternet Posts: 3
edited 2013-07-30 13:54 in Learn with BlocklyProp
Hello all,
I'm terribly sorry if this is a repost. I looked through and searched the forums for the issue i've been having. If it is, please link and i'll try not to be a pest :)

I have a parallax propellor board with a RN42 bluesmirf silver module. I have setup my board and bluetooth with a breadboard and can send to my bluetooth terminal on my phone (GS3) no problem. (Using fullduplexserial64, *.str(string("bla"))). The problem i'm having is that I cannot for the life of me get anything to be read back from the bluetooth terminal to the board! :( The only thing that works is if I bring up the parallax serial terminal and type in something there....it will recognize that, but I want to be able to send something from my phone to the board.

Here's the optoins i've tried:
I've tried using term.rx which seems to be a blocking call until a byte is received. I will spam my terminal on my phone when i see a printout saying its waiting for something to be sent, but nothing works.
I've tried rxcheck which returns all 1's, assuming its a -1 becuase there was no byte read back.
I tried rxtime(200), (500), (2000), etc... with timed values, but still don't get anything from the phone terminal.

I'm convinced its something to do with the phone terminal at this point, I can send to the phone no problem, but sending to the propellor board is at a loss..

ANY help or hints, a link, anything would be awesome.

Thanks for your help,
Theinternet
con


  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000

 RX1  = 31                                                    
 TX1  = 30

obj


  term  : "fullduplexserial64"

pub main |  rxwait, rxcheck


term.start(RX1, TX1, %0000, 115_200)

.
.
.
'Some random code inbetween
.
.

term.str(string("Waiting on term RX ", CR))

'Attempt 1 - This would not read anything back from my phone
          readwait := 0
          readwait := term.rx
          term.str(string("Readwait is : ", CR))
          term.bin(readwait, 8)

'Attempt 2 - I tried adding in rxflush to clear the rx buffer
          
          term.rxflush
readwait := 0
          readwait := term.rx
          term.str(string("Readwait is : ", CR))
          term.bin(readwait, 8)
          repeat while (count < 100)

'Attempt 3 - tried using if, repeat until, etc...  I did rxcheck, txtime and rx, nothing.....
                     ''if(readwait ==0)
                                term.str(string("Read is 0 ", CR))
                                    
                                term.bin(readwait, 8) 
                                 pause(500)
                                 readwait := term.rxtime(200)
                                 rxcheckval := term.rxcheck
                                 term.hex(rxcheckval, 3)






Comments

  • IldefonsoIldefonso Posts: 1
    edited 2013-07-30 10:37
    This thread is relavent to my needs as well.
  • TheinternetTheinternet Posts: 3
    edited 2013-07-30 11:00
    To clarify on a few things:
    1. Sending a character such as "1" through the parallax serial terminal works. My code will exit out of the repeat loop because there was some value read on the rx pin
    2. Sending a character through a bluetooth terminal on a seperate laptop does not work. I have tried chaning CR/LF and turning on/off echo but the data never shows up on the rx pin of the board.
    3. I'm suspicious a little about the bluesmirf, and the fact i've seen some forum posts about others having to quickly send $$$ for cmd mode, etc. I'm not familiar with this, how would this affect the bluesmirfs ability to receive incoming data?
    4. The full duplex serial mode: I've been using mode 0, but have also tried mode 2. Maybe someone can give a better detailed explanation of how the modes differ. I've read the fullduplexserial64.spin, and the definitions don't make much sense.
    Thanks again,
    Theinernet
  • prof_brainoprof_braino Posts: 4,313
    edited 2013-07-30 11:39
    I don't know if this will help but:

    Using forth, we have the prop to android over blue tooth working nicely using the HC05 and HC06 modules. You might be able to use some of that to test where the issue is, the interactive nature of forth makes poking around to debug easier.

    We're using Android 3.0 or greater, and blueterm to start with. We also have an android app (GREEN.apk) that works a little better (blueterm left out the backspace key), but its most useful for the script based interface we use.

    http://code.google.com/p/propforth/wiki/LittleRobotBluetooth

    http://code.google.com/p/propforth/wiki/LittleRobotBluetoothHC06

    http://code.google.com/p/propforth/wiki/LittleRobotBluetoothDETAILS

    The forth itself might be hard to read, but the hardware stuff might apply.
  • TheinternetTheinternet Posts: 3
    edited 2013-07-30 13:54
    Hi prof_braino,
    Thanks for the links. I'll check them out tonight when I get home. :)

    Theinternet
Sign In or Register to comment.