Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Scott Harrison - Bluetooth - Sending a Character Using bt.send
Started by rsp355 Dec 15 2017 05:07 AM

4 replies to this topic
scottharrison bluetooth bt.send corona sdk sending character
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

rsp355

[GLOBAL: userInfoPane.html]
rsp355
  • Observer

  • 10 posts
  • Corona SDK

Hi, 

 

I am having a little bit of trouble with using the bt.send command in Scott Harrison's plugin. 

 

Currently I am using the example app and I've simply added another two buttons to send two different characters. I want to send the two separate characters 'a' & 'b' to my Arduino device to turn an LED on then off via Bluetooth. The micro controller is programmed to turn on the LED when it receives the character 'a' in its serial terminal and then turn off the LED when it receives 'b'. This functionality is able to work with any of the other serial command/Bluetooth terminal app available on the play store. 

 

The example app is able to connect to my Bluetooth device using my Android phone without any issues but I can only send one character from one of the buttons then I have to reopen the app to send the other character with the other button and I'm not sure of how to overcome this. 

 

I should mention that I am a beginner with this. 

 

Below is the code that I added to the example app:

 

local bluetoothSend = widget.newButton{
label = "Send a",
x = display.contentCenterX,
y = display.actualContentHeight-85,
onRelease = function ( event )
bt.send("a")
end,
}
 
 
local bluetoothSendb = widget.newButton{
label = "Send b",
x = display.contentCenterX,
y = display.actualContentHeight-30,
onRelease = function ( event )
bt.send("b")
end,
}
 
I haven't really changed much in the example app other than a few minor position changes and size adjustments.
 
Your assistance will be much appreciated! 
 
Many thanks, 
rsp355


[TOPIC: post.html]
#2

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,822 posts
  • Enterprise

This should be fixed



[TOPIC: post.html]
#3

rsp355

[GLOBAL: userInfoPane.html]
rsp355
  • Observer

  • 10 posts
  • Corona SDK

This should be fixed

 

Thanks for your response Scott. 

 

If I may ask, how would I know if it has been corrected? Would I need to download the example app again? 

 

I should add that I really love the simplicity of the plugin, it is fairly easy to use. We would absolutely love for it to be 100% functional. 

 

Thanks, 

rsp355



[TOPIC: post.html]
#4

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,822 posts
  • Enterprise

Just rebuilding for the device via corona simulator should work.



[TOPIC: post.html]
#5

rsp355

[GLOBAL: userInfoPane.html]
rsp355
  • Observer

  • 10 posts
  • Corona SDK

Just rebuilding for the device via corona simulator should work.

Thanks Scott, this is now working!




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: scottharrison, bluetooth, bt.send, corona, sdk, sending, character