示例#1
0
//Sends out the average fuel level value over CAN
void send_msg() {
    if(CANout.write(CANMessage(CAN_ID, CANdata_array, msg_length))) {      //Send CAN message
        //printf("Data type: %d\r\n", CANdata_array[0]);                   //For testing: terminal output (received data)
        //printf("Data sent: %d\r\n", CANdata_array[1]);                   //For testing: terminal output (received data)
        led2 = !led2;
    }
}
示例#2
0
文件: main.cpp 项目: doniexun/mbed
void send() {
    printf("send()\n");
    CANMessage msg = CANMessage(1337, &counter, 1);
    if(can1.write(msg)) {
        printmsg("Tx message:", &msg);
        counter++;
    }
    led1 = !led1;
}
示例#3
0
文件: main.cpp 项目: tokeller/WeKeBA
void send() {
    pcSerial.printf("send()\n");
    if(can1.write(CANMessage(1337, &counter, 1))) {
        pcSerial.printf("wloop()\n");
        counter++;
        pcSerial.printf("Message sent: %d\n", counter);
        led1 = !led1;
    } 
}
示例#4
0
bool sendCan(int nodeid, char* msg, int len)
{
    bool s = can1.write(CANMessage(nodeid, msg, len));
    if(debug) {
        if(s) pc.printf("Wrote %d bytes to CAN\r\n",len);
        else pc.printf("CAN transmission error\r\n");
    }

    if(debug) {
        pc.printf("> (%d) ", nodeid);
        for(int i=0; i<len; i++) {
            pc.printf("[%2.2X]",msg[i]);
            if(!s && debug) pc.printf(" FAILED",msg[i]);
        }
        pc.printf("\r\n");
    }
    return s;
}