SHARE
TWEET

Untitled

a guest Jan 17th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'mac was not declared in this scope'
  2.    
  3. #include <Ethernet.h>
  4.  
  5. #include <PubNub.h>
  6.  
  7.  
  8.  
  9. void setup() {
  10.     /* For debugging, set to speed of your choice */
  11.     Serial.begin(9600);
  12.  
  13.     /* If you use some other HW, you need to do some other
  14.        initialization of it here... */
  15.     Ethernet.begin();
  16.  
  17.     /* Start the Pubnub library by giving it a publish and subscribe
  18.        keys */
  19.     PubNub.begin(publisher key, subscriber key);
  20. }
  21.  
  22. void loop() {
  23.     /* Maintain DHCP lease. For other HW, you may need to do
  24.        something else here, or maybe nothing at all. */
  25.     Ethernet.maintain();
  26.  
  27.     /* Publish message. You could use `auto` here... */
  28.     PubNonSubClient *pclient = PubNub.publish(pubchannel, ""message"");
  29.     if (!pclient) return;
  30.     PublishCracker cheez;
  31.     cheez.read_and_parse(pclient);
  32.     /** You're mostly interested in `outcome()`, and,
  33.         if it's "failed", then `description()`.
  34.     */
  35.     Serial.print("Outcome: "); Serial.print(cheez.outcome());
  36.     Serial.print(' '); Serial.println(cheez.to_str(cheez.outcome()));
  37.     Serial.print("description: "); Serial.println(cheez.description());
  38.     Serial.print("timestamp: "); Serial.println(cheez.timestamp());
  39.     Serial.print("state: "); Serial.print(cheez.state());
  40.     Serial.print(' '); Serial.println(cheez.to_str(cheez.state()));
  41.     pclient->stop();
  42.  
  43.     /* Wait for news. */
  44.     PubSubClient *sclient = PubNub.subscribe(subchannel);
  45.     if (!sclient) return; // error
  46.     String msg;
  47.     SubscribeCracker ritz(sclient);
  48.     while (!ritz.finished()) {
  49.         ritz.get(msg);
  50.         if (msg.length() > 0) {
  51.             Serial.print("Received: "); Serial.println(msg);
  52.         }
  53.     }
  54.     sclient->stop();
  55.  
  56.     delay(1000);
  57. }
  58.  
  59.  
  60.  
  61. error :-
  62.   sketch_jan17a:28:47: error: 'pubchannel' was not declared in this scope
  63.  
  64.      PubNonSubClient *pclient = PubNub.publish(pubchannel, ""message"");
  65.  
  66.                                                ^
  67.  
  68. sketch_jan17a:44:46: error: 'subchannel' was not declared in this scope
  69.  
  70.      PubSubClient *sclient = PubNub.subscribe(subchannel);
  71.  
  72.                                               ^
  73.  
  74. Multiple libraries were found for "Ethernet.h"
  75.  Used: C:UserssultanAppDataLocalArduino15packagesesp8266hardwareesp82662.5.0-beta2librariesEthernet
  76.  Not used: C:Program Files (x86)ArduinolibrariesEthernet
  77. exit status 1
  78. 'mac' was not declared in this scope
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top