Initialize node with different radio channel
-
I'm trying to choose another channel to make a second network of sensors like this
gw.begin(incomingMessage, 0, true, 0, RF24_PA_MAX, 80, RF24_250KBPS);
but I'm getting an error
EthernetGateway.ino: In function 'void setup()': EthernetGateway:154: error: no matching function for call to 'MySensor::begin(void (&)(const MyMessage&), int, bool, int, rf24_pa_dbm_e, int, rf24_datarate_e)'
it seems the function does not accept the parameters stated in the API docs
How can I achieve this then?
-
You'll have to change channel in MyConfig.h if you're using 1.5.
Not sure which API doc you're referring to but you should look here:
http://www.mysensors.org/download/sensor_api_15#the-full-api
-
@hek said:
http://www.mysensors.org/download/sensor_api_15#the-full-api
That's what I was looking at.
Take a look at the begin method described there:Starting up the library To initialize radio and start the library, you must call begin(). Begin initializes the sensor node but you can also configure the sensor node operating parameters manually. Call this before anything else in the library void begin(void (*_msgCallback)(const MyMessage &), uint8_t nodeId, boolean repeaterMode, uint8_t parentNodeId, rf24_pa_dbm_e paLevel, uint8_t channel, rf24_datarate_e dataRate); incomingMessageCallback - Callback function for incoming messages from other nodes or controller and request responses. Default is NULL. nodeId - The unique id (1-254) for this sensor. Default is AUTO(255) which means sensor tries to fetch an id from controller. repeaterMode - Activate repeater mode. This node will forward messages to other nodes in the radio network. Make sure to call process() regularly. Default in false parentNodeId - Use this to force node to always communicate with a certain parent node. Default is AUTO which means node automatically tries to find a parent. paLevel - Radio PA Level for this sensor. Default RF24_PA_MAX channel - Radio channel. Default is channel 76 dataRate - Radio transmission speed. Default RF24_250KBPS
This should be removed from the page if not possible any more in 1.5 because can cause confusion.
Thank you for the pointer. I'll take a look at MyConfig.h
-
Yes, missed that one. Will remove it. Thanks for reporting.
-
Why did you remove the possibility? if I may ask
-
When radio drivers setup was created in 1.5 the channel radio constructor argument was simply forgotten.
I think there was a pull request fixing this but I will probably not do any more patches of 1.5.