如何解決這個錯誤:編譯例如,mesh.c半自助旅遊旅行社
undefined reference to button sensor
在半自助旅遊旅行社使用Micaz微塵編譯example-mesh.c
什麼時候?
這裏是我的代碼我在mote輸出窗口中運行模擬只有3條消息發送,其餘是「數據包超時」我怎麼能解決這個問題發送消息基於定時器的價值?
#include "contiki.h"
#include "net/rime.h"
#include "net/rime/mesh.h"
#include "contiki-conf.h"
#include "sys/etimer.h"
#include "sys/process.h"
#include "sys/ctimer.h"
#include "dev/leds.h"
#include <stdio.h>
#include <string.h>
#define MESSAGE "Hello"
static struct mesh_conn mesh;
/*---------------------------------------------------------------------------*/
PROCESS(example_mesh_process, "Mesh example");
AUTOSTART_PROCESSES(&example_mesh_process);
/*---------------------------------------------------------------------------*/
static void
sent(struct mesh_conn *c)
{
printf("packet sent\n");
}
static void
timedout(struct mesh_conn *c)
{
printf("packet timedout\n");
}
static void
recv(struct mesh_conn *c, const rimeaddr_t *from, uint8_t hops)
{
printf("Data received from %d.%d: %.*s (%d)\n",
\t from->u8[0], from->u8[1],
\t packetbuf_datalen(), (char *)packetbuf_dataptr(), packetbuf_datalen());
packetbuf_copyfrom(MESSAGE, strlen(MESSAGE));
mesh_send(&mesh, from);
}
const static struct mesh_callbacks callbacks = {recv, sent, timedout};
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(example_mesh_process, ev, data)
{
static struct etimer et;
PROCESS_EXITHANDLER(mesh_close(&mesh);)
PROCESS_BEGIN();
mesh_open(&mesh, 132, &callbacks);
while(1) {
rimeaddr_t addr;
etimer_set(&et, 5 * CLOCK_SECOND);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
etimer_reset(&et);
/* Send a message to node number 1. */
packetbuf_copyfrom(MESSAGE, strlen(MESSAGE));
addr.u8[0] = 1;
addr.u8[1] = 0;
mesh_send(&mesh, &addr);
}
PROCESS_END();
}
/*---------------------------------------------------------------------------*/
歡迎來到StackOverflow!你的問題中的兩個句子基本上具有相同的內容,但作爲讀者,我仍然只對你想要做什麼以及什麼是問題有一個粗略的概念。你可能想用更多的信息來更新你的問題,但是一定要先閱讀[如何提出一個好問題](http://stackoverflow.com/help/how-to-ask)。 – 2015-03-08 19:15:35
並非所有Contiki應用程序都適用於所有平臺。你真的需要使用'micaz'嗎?這是古老的。 – kfx 2015-03-08 19:21:06
是的,我需要模擬使用Micaz,但是編譯時給我一個編譯錯誤「underfined button_sensor」我該如何克服這個問題@kfx – 2015-03-08 22:11:48