analogWrite(power,4095) on xenon, no output

This should be simple, but I forked the subscribe.ino and am running the demo for mesh, and my xenon is not giving out any voltage. I have a multimeter on the pin A5. It indicates 0v.
Code:

int led = D3;
int boardLed = D7;
int photoresistor = A0;
int power = A5;

int intactValue;
int brokenValue;
int beamThreshold;

bool beamBroken = false;

// We start with the setup function.

void setup() {
  // This part is mostly the same:
  pinMode(led,OUTPUT); // Our LED pin is output (lighting up the LED)
  pinMode(boardLed,OUTPUT); // Our on-board LED is output as well
  pinMode(photoresistor,INPUT);  // Our photoresistor pin is input (reading the photoresistor)
  pinMode(power,OUTPUT); // The pin powering the photoresistor is output (sending out consistent power)
 Serial.begin(9600);
  // Here we are going to subscribe to your buddy's event using Particle.subscribe
  Particle.subscribe("myhelen", myHandler);
  // Subscribe will listen for the event buddy_unique_event_name and, when it finds it, will run the function myHandler()
  // (Remember to replace buddy_unique_event_name with your buddy's actual unique event name that they have in their firmware.)
  // myHandler() is declared later in this app.

  // Next, write the power of the photoresistor to be the maximum possible, which is 4095 in analog.
  **analogWrite(power,4095);**

@TomEldredge, you may want to review the docs regarding analogWrite().

https://docs.particle.io/reference/device-os/firmware/xenon/#analogwrite-pwm-

The parameter passed has a maximum value of 255. The Xenon analog output is not a DAC. Instead, it is a PWM output.

6 Likes