"Are there any guidelines on how to convert a sketch that was made for the 1.3 libraries to 1.4?
I would very much like to use the DimmableLED sketch but I know too little about coding. I found a few obvious differences but nevertheless did not succeed in making the sketch work.
I found it here: http://forum.micasaverde.com/index.php/topic,23342.0.html and I know the maker blacey is also on this forum and think it is a very nice sketch. The only way I see how to get this to work is to downgrade to the 1.3 libraries but than I would have to start all over."
It's not easy to cover all possibilities but here are a few notes and examples based on a temperature sensor plus some other info that might help with the DimmableSketch. I can re-edit this post if there are any corrections needed or something else needs to be added.
AT THE START OF THE PROGRAM:
#include <Sensor.h> change to #include <MySensor.h>
#include <EEPROM.h> <-- this line is no longer required - delete
#include <RF24.h> <-- this line is no longer required - delete
Sensor gw; change to --> MySensor gw;
Sensor gw(9,10); change to --> MySensor gw;
// Initialize temperature message <-- insert line
MyMessage msg(0,V_TEMP); <-- insert line
IN void setup():
// send the Sketch Version Information to the Gateway <-- insert line
gw.sendSketchInfo("My sketch name", "0.50"); <-- insert line
gw.sendSensorPresentation(i, S_TEMP); change to --> gw.present(i, S_TEMP);
metric = gw.isMetricSystem(); change to --> metric = gw.getConfig().isMetric;
IN void loop():
// process incoming messages (like config from server) <-- insert line
gw.process(); <-- insert line
gw.sendVariable(i, V_TEMP, temperature, 1); change to --> gw.send(msg.setSensor(i).set(temperature,1)); // send float with one decimal point
SEARCH FOR THE FOLLOWING:
gw.powerUp(); <-- this line is no longer required - delete if found
sendSensorPresentation change variable name to --> present
If the following is found then this can be deleted:
// Set RADIO_ID to something unique in your sensor network (1-254)
// or set to AUTO if you want gw to assign a RADIO_ID for you.
#define RADIO_ID AUTO
If the #define RADIO_ID AUTO was found and deleted as above then change this also
gw.begin( RADIO_ID ); change to --> gw.begin();
OTHER EXAMPLE MESSAGES:
// batteryPcnt is a uint8_t
// I've not checked this
gw.sendVariable( 0, V_DIMMER, currentLevel ); change to --> gw.send(currentLevel);
INITIALIZING THE SENSOR TO HANDLE A MESSAGE FROM THE MAIN GATEWAY:
// handle incoming messages
void incomingMessage(MyMessage message)
// handle your messages here
// I've not checked this
// the call back incomingMessage receives any incoming messages