Project

General

Profile

Compile errors Jeenode micro

Added by Alban_T over 3 years ago

Hi I tried to compile/upload my sketch using my Arduino Uno as ISP.
The wireing shouldn’t be a problem for now because the errors occur during compilation, I didn’t get to uploading yet.
Uploading to my regular Jeenode works fine :s

Compiling 'ReceiveNode' for 'JeeNode Micro'
math.h:426:15: error: expected identifier or '(' before 'double'
wiring.h:136:26: error: expected ')' before '>=' token
Error compiling core

I hope someone has a solution for this!?

For completeness I’ll put my sketch below:

#include 

// interrupt handler for JeeLabs Sleepy power saving
ISR(WDT_vect) { Sleepy::watchdogEvent(); }  

const int myNodeID = 30;                            // RF12 node ID in the range 1-30
const int network = 210;                            // RF12 Network group
const int freq = RF12_868MHZ;                       // Frequency of RFM12B module
byte myId;                                          // remember my own node ID

const int LEDpin = 4;                               // a LED is connected between DIO1 and GND on the JeeNode
const int LEDpinRed = 7;
int numSensors;     // Variable used to determine the amount of parallel DS18B20 sensors in the network
const boolean DEBUG = false;


//############################################################################################################
//Data Structure to be sent
typedef struct {
    int nodeID;     // ID of the node
    int supplyV;    // Supply voltage
    int temp0;      // Temperature reading
    int temp1;      // Temperature 2 reading
    int tempSHT;    // Temperature 3 reading
    int humiSHT;    // Humidity reading
} Payload;
Payload temptx;     // Instantiate a Payload object

typedef struct {
    byte Jeenode;       // identify the Jeenode
    byte Requestcode;   // identify the needed response
} RequestPayload;
RequestPayload requesttx;

//############################################################################################################

void setup() {
    Serial.begin(9600);
    Serial.println("ReceiverNode.ino");
    pinMode(LEDpin,OUTPUT);
    pinMode(LEDpinRed,OUTPUT);

    digitalWrite(LEDpin,HIGH);
    digitalWrite(LEDpinRed,HIGH);
    delay(500);
    digitalWrite(LEDpin,LOW);
    digitalWrite(LEDpinRed,LOW);

    myId = rf12_initialize(myNodeID,freq,network);          // Initialize RFM12 with settings defined above
    //myId = rf12_configSilent();                       // Initialize RFM12 with its internal settings
    Serial.print("myId = ");Serial.println(myId);
    rf12_configDump();                              // Print the settings to the serial port
    Serial.flush();

}


long prevMillis;
long diffMillis;
void loop() {

    // receive a space (ASCII 32) thru Serial to trigger the request
    // send data only when you receive data:
    if (Serial.available() > 0) {
        // read the incoming byte:
        byte incomingByte = Serial.read();
        byte node = incomingByte - 48;
        if (node >= 1 && node <= 9) {
            digitalWrite(LEDpin,HIGH);
            if (DEBUG == true) {
                Serial.print("RequestData("); Serial.print(node); Serial.println(",1)");
                Serial.flush();
            }

            prevMillis = millis();
            RequestData(node,1);
            digitalWrite(LEDpin,LOW);
        }
    }   

        ReceiveData();



}

// receive measurement results from JeeNode 2
 void ReceiveData() {
    if (rf12_recvDone() && rf12_crc == 0){
        digitalWrite(LEDpinRed,HIGH);
        int numSensors = rf12_len/2 - 2;
        const Payload* p = (const Payload*) rf12_data;

        if (DEBUG == true) {
            Serial.println("");
            Serial.println("Received payload: ");
            Serial.print("temptx.nodeID = "); Serial.println(p->nodeID);
            Serial.print("temptx.temp0 = "); Serial.println(p->temp0);
            Serial.print("temptx.temp1 = "); Serial.println(p->temp1);
            Serial.print("temptx.tempSHT = "); Serial.println(p->tempSHT);
            Serial.print("temptx.humiSHT = "); Serial.println(p->humiSHT);
            Serial.print("temptx.supplyV = "); Serial.println(p->supplyV);
            Serial.println("*************************");
            diffMillis = millis() - prevMillis;
            Serial.print("Request took ");Serial.print(diffMillis);Serial.println("ms");
            Serial.flush();
        }
        else {
            Serial.print(p->nodeID);Serial.print(";");
            Serial.print(p->temp0);Serial.print(";");
            Serial.print(p->temp1);Serial.print(";");
            Serial.print(p->tempSHT);Serial.print(";");
            Serial.print(p->humiSHT);Serial.print(";");
            Serial.print(p->supplyV);Serial.print(";");
            diffMillis = millis() - prevMillis;
            Serial.print(diffMillis);Serial.println(";");
            Serial.flush();
        }
        digitalWrite(LEDpinRed,LOW);
   }
}

void RequestData(int node, byte request) {

    // request temperature data from the other Jeenodes
    requesttx.Jeenode = node;
    requesttx.Requestcode = request;
    if (rf12_canSend()) {
        rf12_recvDone();
        rf12_sendStart(0, &requesttx, 2);       
        rf12_sendWait(2);                                //wait for RF to finish sending while in standby mode
    }       

}

Replies (3)

RE: Compile errors Jeenode micro - Added by JohnO over 3 years ago

Hi Alban,

An interesting error message. I don’t have an answer yet but I see that you are using Serial.read and I don’t see any SoftwareSerial included or anything else to provide serial input support. The ATTiny84 unfortunately doesn’t have any UART hardware to handle hardware serial support. The current Jeelib for Tiny includes code from TinyDebugSerial which does provide limited serial output ONLY support. Having said that I don’t see the link to your error message yet.

With your current code you could try a couple of options:
1) include SoftwareSerial - memory permitting
2) Use the code included in RF12Demo that creates an interrupt driven serial input capability.

RE: Compile errors Jeenode micro - Added by JohnO over 3 years ago

I forgot to mention that I can reproduce the error.

RE: Compile errors Jeenode micro - Added by Alban_T over 3 years ago

Glad to hear you can reproduce the error.

I feel a bit stupid that I didn’t realize that Serial.read isn’t possible on the micro.
Think I need to address that first :)

Thanks for the swift response!

    (1-3/3)