On a remote device I want to output a PWM signal from P0 on a XBee Por SB2.
Is it ever possible? here’s my configuration
XCTU reports
P0 = 1 RSSI PWM OUTPUT
P1 = 0
P2 = 0
Here are the main lines
private static final IOLine DEV1_PWM1 = IOLine.DIO10_PWM0;
remoteDevice1.setIOConfiguration(DEV1_PWM1_OUT, IOMode.PWM);
/* Here I get
com.digi.xbee.api.exceptions.ATCommandException: There was a problem sending the AT command packet. > Invalid parameter
*/
int iDutyCycle = 35;
remoteDevice1.setPWMDutyCycle(DEV1_PWM1, iDutyCycle);
Are you using a programmable XBee module or some other? What is the part number of the module you are working with and what firmware version is installed in it?
I am saying that what I have done with the DIO pins works. When I try to call any function on the PWM pin (setIOConfiguration(DIO11/PWM1, PWM output) or setPWMDutyCycle(DIO11/PWM1, 50)), I get the error -
com.digi.xbee.api.exceptions.ATCommandException: com.digi.xbee.api.exceptions.ATCommandException: There was a problem sending the AT command packet. > Invalid command
at com.digi.xbee.api.AbstractXBeeDevice.checkATCommandResponseIsValid(AbstractXBeeDevice.java:1812)
at com.digi.xbee.api.AbstractXBeeDevice.sendParameter(AbstractXBeeDevice.java:2059)
at com.digi.xbee.api.AbstractXBeeDevice.setParameter(AbstractXBeeDevice.java:1972)
at com.digi.xbee.api.AbstractXBeeDevice.setPWMDutyCycle(AbstractXBeeDevice.java:1455)
That is because the commands you are trying to use do not exists on the radios firmware. That is the radio that you are using does not support that function. The PWM can only be set for RSSI output on that radio.
When I call hasPWMCapability() on the pin (DIO10/PWM0 or DIO11/PWM1)I get a true.
I am looking for a way to send a variable voltage (or signal) out of a pin and be able to control that voltage (or signal) from the api.
Not sure I understand what you are saying. I have the option in XTCU to set port DIO10 to RSSI PWM OUTPUT and I still get the error.
XBeeCoordinator: setUpDevices: PWM: DIO10/PWM0
XBeeCoordinator: setUpDevices: PWM: PWM output
XBeeCoordinator: setUpDevices: PWM: 50
#######################
com.digi.xbee.api.exceptions.ATCommandException: There was a problem sending the AT command packet. > Invalid command
at com.digi.xbee.api.AbstractXBeeDevice.checkATCommandResponseIsValid(AbstractXBeeDevice.java:1812)
at com.digi.xbee.api.AbstractXBeeDevice.sendParameter(AbstractXBeeDevice.java:2059)
at com.digi.xbee.api.AbstractXBeeDevice.setParameter(AbstractXBeeDevice.java:1972)
at com.digi.xbee.api.AbstractXBeeDevice.setPWMDutyCycle(AbstractXBeeDevice.java:1455)
You are reading the wrong manual. That manual is for the Java script. You need to read the manual for the XBee module also to see if it supports these functions. In this case, the XBee does not.