For this example, attach a LED to a PWM-enabled Pin on your Arduino Uno. Let’s use D6 in this example.
Click Add New
> Device / Widget
- Choose Actuator > Light > Luminosity.
- Choose Virtual from the I/O field.
- We will use Virtual Pin 1 for this example. Choose V1 from the Pin field.
- Click the Step 1: Sketch File button to view the sketch file.
A popup will appear showing the Luminosity sketch file. Copy the sketch file contents to the clipboard and open Arduino IDE.
Paste the Luminosity sketch file code into the Arduino IDE. After copying & pasting the example sketch files:https://github.com/myDevicesIoT/CayenneArduinoSamples/tree/master/Actuators, you will want to double check that your authentication token
is correct as well as update any pin assignments that appear in the sketch file.
In this case, the example sketch file assumes that we used Digital Pin 3 to connect our Luminosity actuator, but we used Digital Pin 6 instead. We will need to update the sketch file to correct the pin. Find and update the LED_DIGITAL_PIN
definition so that it points at pin 6.
#define LED_DIGITAL_PIN 6
After verifying the sketch file looks good, select Sketch
to upload the sketch file to your device.
In the Cayenne dashboard, you can now click the Step 2: Add Actuator
button and the luminosity widget will be added to your dashboard. You can now use the slider to control the brightness of the LED.