2017년 3월 22일 수요일

Bluetooth problem


my app as created for arduino.
My problem is bluetooth , i have to connect and disconnect automatically the bluetooth with press button the my app
Example

I press the light button, you must connect to the bluetooth, switch on the light or disconnect bluetooth

--
what exactly is your problem?
have you seen

-- 
My problem is , connect and disconnect Bluetooth when press buttons in my app. Example
Press button light garage
connect Bluetooth 
On or off light garage
Disconnect bluetooth.

Press button lighr kitchen
Connect Bluetooth 
On or off light kitchen
Disconnect Bluetooth 

In automatic this operation 

Now my app, connect forever a Bluetooth.
This because Bluetooth accept one device at a time , I connect a Bluetooth six device

-- 
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

-- 
ok my blocks

push buttons.... when Bar. click , when soffusa .click ecc....
my app connect bluetooth , run the function and disconnect bluetooth

now push buttons
my app run the function .....STOP :-(

Immagine.jpg 표시 중

-- 
as far as I understand you want to toggle the light switch
what about sending only one command to the other device and there add some logic like this

if light = on  
then set light to off
else set light to on

-- 
No, my problem not light on / off, but Bluetooth connect / disconnect

--
you already connect automatically in Screen.Initialize
you also can send something after connecting, just add a SendText block in the Screen.Initialize event and after that a Disconnect method and probably a close application block...

-- 
Your kitchen and garage are different devices with different connection strings?

That sounds like you have to start the connection from the button Click event,
save in a global variable a reminder of what you wanted to talk to and what you
wanted to say to it when the connection is complete, then after the connection is complete
(a timer?) send the command on that connection?

-- 
My app propabily solution

I press the button garage
my app starts screen.initialitze run command disconnects
Then we press the button cooking
my app starts screen.initialitze executes the command and disconnects

my problem and tell him to start from screen.initialitze


--
what about using a procedure?
see also Chapter 21 here http://www.appinventor.org/book2

--

댓글 없음:

댓글 쓰기