First project with photoresistor and LED - sketch issues


#1

I am using Arduino Uno r3 with Wifi shield WINC1500 which works as expected.
However when I added my Arduino to Cayenne and tried to use LED or photoresistor I am getting code without any extra code to add this devices.

/*

Cayenne Photoresistor Example

This sketch shows how to automatically send data to a Photoresistor Sensor in the Cayenne Dashboard.

The Cayenne Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

Steps:

  1. In the Cayenne Dashboard add a new Photoresistor widget.
  2. Set the widget to Value Display.
  3. Select the Integrated ADC and a pin number.
  4. Attach a photoresistor to the analog pin on your Arduino matching the selected pin.
    Make sure to use an analog pin, not a digital pin.
    Schematic:
    [Ground] – [10k-resistor] – | – [Photoresistor] – [5V]
    |
    Analog Pin
  5. Set the token variable to match the Arduino token from the Dashboard.
  6. Compile and upload this sketch.
  7. Once the Arduino connects to the Dashboard it should automatically update the Photoresistor widget with data.
    */

#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space

// If you’re not using the Ethernet W5100 shield, change this to match your connection type. See Communications examples.
//#include <CayenneEthernet.h>
#include <CayenneWiFi101.h>

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = “MYTOKEN”;
char ssid[] = “MYWIFINETWORK”;
char password[] = “MYSUPRSECRETPASSWORD”;

void setup()
{
WiFi.setPins(8,7,4);
Serial.begin(9600);
Cayenne.begin(token, ssid, password);
}
void loop()
{
Cayenne.run();
}

what is happening? do I miss something obvious? My understanding is that Cayenne should add all code I need for me.


#2

So the issue is that your Arduino will not show up in Cayenne? Or that you cannot add an LED and a Photoresistor? Thanks for helping to clarify!

-B


#3

Hi Bestes

My arduino shows in Cayenne, however I tough when I add LED, Photoresistor or anything else this will be added to the code that I can copy and upload to arduino. However I think that is not the case, as its being handled by communication with Cayenne website through their library? is that correct?

Now I have on my panel under my arduino uno LED and Phtoresistor.
When I click switch LED ON nothing is happening.
With Photoresistor i got few wired readings, very slow. Maybe I am doing something wrong?
not sure.
I have followed wiring from tutorial (and from my other outside cayenne projects) but still unable to make my UNO to switch on/off LED or take correct reading from Photoresistor.