pubnub / arduino Goto Github PK
View Code? Open in Web Editor NEWThe Official PubNub Arduino-based API!
License: Other
The Official PubNub Arduino-based API!
License: Other
I'm glad to see that you have posted a library modficiation for the Adafruit Feather M0. It's important to note that Adafruit publishes their own Wifi101 equivalent library called Adafruit_WINC1500.h
Fortunately this takes care of all the pin differences and more. Seeing that I am successfully using the Adafruit library already, it gets messy with mismatching later because the Wifi101.h libarary is called in the pubnub.cpp file.
That said, I cannot even get Arduino 1.6.8 to even compile the basic example files. Getting declaration errors relative to WiFi and WiFiClient. Could there be an issue with Arduino IDE versioning requirements?
Regarding SSL Support: The comments below are copied from PubNub.h.
However the Adafruit Feather M0 WINC1500 does support SSL. How do we resolve this?
/* Some notes:
*
* (i) There is no SSL support on Arduino, it is unfeasible with
* Arduino Uno or even Arduino Mega's computing power and memory limits.
* All the traffic goes on the wire unencrypted and unsigned.
Can this be better annotated to show exactly which lines needed to be modified? Or better yet create a library that is default for wifi with reference to Adafruit_WINC1500.h , instead of asking the user to change all the ethernet defaults? Less obstacles means easier adoption of PubNub. Hopefully you can help. Thanks
Hello, I started using PubNub for my new arduino (on ESP8266) but I want to publish messages by GPRS with SIM800 module. I'm using TinyGSM lib for other things like reading/sending sms'es etc.
TinyGSM provides TinyGsmClient class that can be used as PubNub_BASE_CLIENT but there is small problem. TinyGsmClient class require existing TinyGsm passed into constructor or as parameter of init method (if used prameterless constructor). PubNub_BASE_CLIENT is instantiated inside PubNub class and I have no possibility to pass constructor paramters or execute init method before publish.
Will it be possible to do something on PubNub_BASE_CLIENT before publish? Or better provide own instance of PubNub_BASE_CLIENT.
Now I have workaround for this by publish messages using PubNub http api with this example:
https://github.com/vshymanskyy/TinyGSM/blob/master/examples/HttpClient/HttpClient.ino
There's a new (and cheaper, compared to the normal WiFi shield) breakout/shield using the TI CC3000 WiFi chip available from Adafruit (same chip as used on the spark.io cores, I think). It would be great if we could use PubNub with it!
Dear,
I am trying to use PubNub with ENC28J60 chip, where this chip uses the following library https://github.com/jcw/ethercard .
Does you support this chip?, if yes can you please let me know which files should be modified.
Thank you.
Hi
How I can use this library with Arduino Yùn board, do you hav an example?
Thanks
Luigi
I tried to push the fix myself, but I guess I don't have the permissions. Anyways, it should read like the following:
/* By default, the PubNub library is built to work with the Ethernet
* shield. WiFi shield support can be enabled by commenting out the
* following line and uncommenting the line after that. Refer
* to the PubNubJsonWifi sketch for a complete example. */
Hey,
I tried setting up an arduino which publishes some messages to an node js server, but I cannot get an publisher name out of it. I searched the docs and found nothing really useful. I set an uuid before the PubNub begin with ( PubNub.set_uuid(uuid); ), but it had no effect. The Application just returns an undefined. How can I set this up?
Thanks for help
The latest sample sketch doesn't compile due to a number of issues. The first issue is in line 17 of the PubNubWifi101 sketch -
#define Pubnub_BASE_CLIENT WiFiClient
In <PubNub.h>, it is expecting the #define to be
#define PubNub_BASE_CLIENT EthernetClient
-- note that Pubnub and PubNub have different cases.
There are other errors too, and tons of warnings.
I have tried the other examples, none of them compile. There are undefined references to various string compare functions.
I'm using Arduino 1.6.13 on Ubuntu 14.04. The PubNub libraries and sample sketches were obtained today from GitHub.
I might have misunderstood how things work, so apologies if that's the case.
I am using the Pubnub's Debug Console as my guide. Here I can set up individual authorisation keys for different channels.
Within the Arduino library code there is set_auth(const char* auth) { d_auth = auth; }
but this sets up an authorization key/token for a PubNub client.
How can the code/library be changed so that a separate auth key can be used for publish and subscribe.
Pubnub allows restriction of stream subscription to users with a valid PAM token, this token is provided by adding the argument ?auth= to the GET request URL.
It would be fantastic if this library was supported on the ESP8266 microcontroller. The ESP8266 Arduino environment provides a WiFiClient that is derived from the Arduino's Client class so it shouldn't be a huge effort to support it.
I am trying to make it work to wait for message and every some time to go and send a message
It's waiting and after is not coming out properly and unable to wait again for the messages
The support told me that they are not dealing with it since 2019. Really disappointed.
Hi there,
I'm having an issue subscribing and reading events using the subscribe method. It seems to continually loop through the wait/read data method, with an empty response. I used the example subscribe code provided in this repo.
If I change the below lines to simply return client.read(), then the event json is returned, however subsequent messages are incomplete.
https://github.com/pubnub/arduino/blob/master/PubNub.cpp#L169-L176
As I mentioned in the ticket #15 the addition of the provided code to PubNubDefs.h
and I see my messages get published once. Thanks! However, upon publishing, the Adafruit Feather ESP8266 seems to be crashing. As soon as it publishes, i see the message come in on the pubnub dashboard I see an Exception(3) in the serial port of the Arduino IDE. The full error output from the serial is below. Any ideas as to what might be causing the issue? Or a potential area that might be causing the problem?
The code I added to PubNubDefs.h
was placed at the end of the script after the #endif
on line # 692
The message I'm posting is: "{num:1, txt:'Yo!'}"
Beginning of loop...
Exception (3):
epc1=0x40201e66 epc2=0x00000000 epc3=0x00000000 excvaddr=0x4023004c depc=0x00000000
ctx: cont
sp: 3ffef3c0 end: 3ffef720 offset: 01a0
\>>>stack>>>
3ffef560: 40105244 0055ec10 00005419 40201e29
3ffef570: 65746144 6f4d203a 33202c6e 614a2030
3ffef580: 3032206e 30203731 36333a32 3ffee700
3ffef590: 00000000 00001388 00000044 00000036
3ffef5a0: 0000001c 00000004 3fff0bfc 40202e7a
3ffef5b0: 00000000 3ffee554 3ffee568 3ffef634
3ffef5c0: 00000000 3ffee554 3ffee568 402024a8
3ffef5d0: 00463625 00000006 3ffef6e8 40203671
3ffef5e0: 00005419 3ffe85af 3ffef620 0000001e
3ffef5f0: 3ffef634 3ffee550 3ffef6e8 402036bc
3ffef600: 3ffe8565 000001f4 3ffee6c0 3ffee6ec
3ffef610: 000000c8 3ffee550 3ffee6c0 4020257b
3ffef620: 756e7b22 2c313a6d 74787420 6f59273a
3ffef630: 227d2721 fee4f000 fe83543f 3430313f
3ffef640: fee4c400 202b2d3f fe84c540 0000003f
3ffef650: 00000009 4affffff 77616853 00302e32
3ffef660: feefeffe feefeffe feefeffe 3ffef6f0
3ffef670: 3ffee6c0 00000009 00000003 40203456
3ffef680: 00216b72 00000001 3ffe8489 40203ba0
3ffef690: 00000000 0000000c 3ffe84d4 3ffee6ec
3ffef6a0: 3ffe86df 0000000d 3ffee6c0 40203339
3ffef6b0: 3ffe8488 3ffee5d0 3ffee6c0 40203339
3ffef6c0: 3ffe84c8 3ffee5d0 3ffee6c0 40203364
3ffef6d0: 680010ac 00ffffff 3ffee6c0 40203388
3ffef6e0: 3ffe8350 3ffee5d0 3fff0d2c 0000001f
3ffef6f0: 00000014 680010ac feefeffe feefeffe
3ffef700: 3fffdad0 00000000 3ffee6e4 4020385c
3ffef710: feefeffe feefeffe 3ffee700 40100718
<<<stack<<<
ets Jan 8 2013,rst cause:2, boot mode:(1,6)
ets Jan 8 2013,rst cause:4, boot mode:(1,6)
wdt reset
Thanks,
Hi
as per title, I'm using MKR1000 board, i can verify and upload the sketch but on serial monitor it pop up publishing error. below is the sketch
#include <SPI.h>
#include <WiFi101.h>
#define PubNub_BASE_CLIENT WiFiClient
#include <PubNub.h>
static char ssid[] = ""; // your network SSID (name)
static char pass[] = ""; // your network password
int status = WL_IDLE_STATUS; // the Wifi radio's status
const static char pubkey[] = "pub-c-b5092f02-f467-4795-b5ba-97286b6cb961"; //PubNub wifi101 Dev
const static char subkey[] = "sub-c-b60400ce-23f6-11e7-bd07-02ee2ddab7fe";
const static char channel[] = "hello_world";
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("Serial set up");
// attempt to connect using WPA2 encryption:
Serial.println("Attempting to connect to WPA network...");
status = WiFi.begin(ssid, pass);
// if you're not connected, stop here:
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
while (true);
} else {
Serial.print("WiFi connecting to SSID: ");
Serial.println(ssid);
PubNub.begin(pubkey, subkey);
Serial.println("PubNub set up");
}
}
void loop() {
/* Publish */
WiFiClient *client;
char msg[] = ""running"";
client = PubNub.publish(channel, msg);
if (!client) {
Serial.println("publishing error");
delay(1000);
return;
}
client->stop();
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.