Skip to content

I dont want to sleep.... #84

@grichfitz

Description

@grichfitz

I am using the following code for the wireless stick, it seems to be the only workable example for uploading to the helium network.

It seems a bit over complex and must sleep. I want to do the following:

Join...
Loop updating the display with sensor data..
Every 10 mins
Send sensor data

But the following code, must sleep otherwise it doesnt work.

Does anyone have a better example?

void loop()
{

switch( deviceState ){
case DEVICE_STATE_INIT:
{
LoRaWAN.init(loraWanClass,loraWanRegion);
break;
}
case DEVICE_STATE_JOIN:
{
Display.clear();
Display.drawString(2, 0, "Joining...");
Display.display();
LoRaWAN.join();
break;
}
case DEVICE_STATE_SEND:
{
Display.clear();
Display.drawString(2, 0, "Sending...");
Display.display();
prepareTxFrame(appPort);
LoRaWAN.send(loraWanClass);
deviceState = DEVICE_STATE_CYCLE;
break;
}
case DEVICE_STATE_CYCLE:
{
// Schedule next packet transmission
txDutyCycleTime = appTxDutyCycle + randr( -APP_TX_DUTYCYCLE_RND, APP_TX_DUTYCYCLE_RND );
LoRaWAN.cycle(txDutyCycleTime);
deviceState = DEVICE_STATE_SLEEP;
break;
}
case DEVICE_STATE_SLEEP:
{
getData();
LoRaWAN.sleep(loraWanClass,debugLevel);
break;
}
default:
{
deviceState = DEVICE_STATE_INIT;
break;
}
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions