Plugin to create buttons to send TalkBack commands | ThingSpeak Plugins | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Plugin to create buttons to send TalkBack commands
No permission to create posts
June 28, 2014
1:56 pm
Avatar
bborncr
New Member
Members
Forum Posts: 4
Member Since:
June 28, 2014
sp_UserOfflineSmall Offline

Is it possible to create a plugin to create buttons to send TalkBack commands? A point in the right direction would be appreciated.

Regards,

June 29, 2014
1:08 pm
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

Hi,

Yes you can create a plugin to send TalkBack commands. The easiest way to do this would be to create a HTML button, add an "onclick" event handler, and then use jQuery.ajax() ( http://api.jquery.com/jQuery.ajax/ ) to send the command data to ThingSpeak ( https://thingspeak.com/docs/talkback#add_command ). Please let me know if you need further help!

lee

June 30, 2014
5:08 pm
Avatar
bborncr
New Member
Members
Forum Posts: 4
Member Since:
June 28, 2014
sp_UserOfflineSmall Offline

Thanks for the reply. I tried the following which doesn't seem to be working:

https://thingspeak.com/plugins/4376/edit

June 30, 2014
8:30 pm
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

Hi,

I can't view your plugin, it's currently set to "private". Please edit the plugin and uncheck the "private" field and I'll take a look at it.

lee

June 30, 2014
10:12 pm
Avatar
bborncr
New Member
Members
Forum Posts: 4
Member Since:
June 28, 2014
sp_UserOfflineSmall Offline

The private field is unchecked. I just went in and saved it again. It's still unchecked.

July 1, 2014
1:58 am
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

Hi,

Sorry you're right, the plugin is public, the link was just to the edit page which I couldn't access.

In your code, it may be helpful to update jQuery to a newer version. Also, your post function looks like it should be changed to:

$.post('https://api.thingspeak.com/talkbacks/499/commands.json?apikey=MYAPIKEY&command_string=TURN_ON&position=1');

The turnOff function should follow the same format. Also make sure to set MYAPIKEY correctly to your TalkBack API key.

lee

July 1, 2014
5:37 am
Avatar
bborncr
New Member
Members
Forum Posts: 4
Member Since:
June 28, 2014
sp_UserOfflineSmall Offline

That was it! Just sloppy syntax errors!

Thanks,

December 28, 2014
12:20 am
Avatar
zesty
New Member
Members
Forum Posts: 3
Member Since:
December 27, 2014
sp_UserOfflineSmall Offline

I see there isn't a button example posted in the forums yet. I need help implementing a Talkback button.

This is that I have now that doesn't return anything using the "execute" API.
HTML Window between body: (arrows left out on purpose)
button onclick="myFunction()">Click me</button

And Javascript window:

function myFunction()
{
$.post('https://api.thingspeak.com/talkbacks/1026/commands.json?apikey=[MYKEY]&command_string=TURN_ON&position=1');
}

Thank you.
Scott

December 29, 2014
9:29 am
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

Hi Scott,

Can you provide me with the ID of your plugin (or its URL) and I'll take a look at it?

lee

December 29, 2014
10:59 am
Avatar
zesty
New Member
Members
Forum Posts: 3
Member Since:
December 27, 2014
sp_UserOfflineSmall Offline

Here it is. I don't know what I'm doing. :) As far as I'm concerned, I'd settle for the easiest means to send TalkBack commands from a weblink or button on webpage.

https://thingspeak.com/plugins/6998

December 29, 2014
1:43 pm
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

Hi Scott,

It looks like your code is correct, but you need to add a link to the jQuery library so that your JavaScript will run correctly. In the head tags inside the body section, add the following line:

Here's a full example that I made: https://thingspeak.com/plugins/6664 .

lee

December 29, 2014
2:07 pm
Avatar
zesty
New Member
Members
Forum Posts: 3
Member Since:
December 27, 2014
sp_UserOfflineSmall Offline

This is fantastic. Thank you!

I'd suggest adding this code to the TalkBack documentation as an example.

June 3, 2018
4:51 pm
Avatar
mehmetalisubasi
New Member
Members
Forum Posts: 2
Member Since:
May 23, 2018
sp_UserOfflineSmall Offline

Hello Everyone,

I made a toggle button just like you guys discribe. But How am I going to read the value from arduino uno? I want to turn on-off a servo motor. Thank you all.

June 10, 2018
5:21 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 287
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

mehmetalisubasi,

Does your application need to read the value from the arduino? You could just have the Arduino poll the thingspeak channel and change its servo power on state to match the state of the channel.

You can use the talkback app to queue commands and then have the arduino poll for commands in the queue. You can use MQTT to subscribe to the channel, and then the MQTT broker will push updates to your device when the channel value is changed.
Here is a particle photon example for MQTT subscribe.
https://www.mathworks.com/help/thingspeak/use-particle-photon-client-to-subscribe-to-channel-updates.html
You can do similar things on an arduino with the pubsub library.

You can also just make a loop in your arduino code that polls the channel continuously to look for a change, like this cheerlights example:
https://community.thingspeak.com/tutorials/arduino/cheerlights-with-arduino-and-the-fastled-library/

Here is an example for reading from and writing to ThingSpeak with the Communication library.
https://www.mathworks.com/help/thingspeak/rapid-prototyping-with-thingspeak.html

If you really need the arduino to write the state to your channel, then use the writing part of the examples (write with the REST API), or MQTT publish to put the state of the servo into your channel.

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online: samdavies
13 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

Lakshmanaprakash S B, bettetj60, ronnievw3, bessiesj18, Pavan kumar, Williampup

Administrators: Hans: 387, lee: 457