void recv(struct broadcast_conn *ptr, const rimeaddr_t * sender) {
char * val = (char *) packetbuf_dataptr();
printf("node %d: recv from %d: %d\n", rimeaddr_node_addr, *sender, *val);
- // FIXME
- if(*val % 2) {
- leds_toggle(LEDS_GREEN);
+
+ if((*val) & 0x01) {
+ leds_on(LEDS_GREEN);
+ } else {
+ leds_off(LEDS_GREEN);
+ }
+ if((*val) & 0x02) {
+ leds_on(LEDS_YELLOW);
+ } else {
+ leds_off(LEDS_YELLOW);
}
- leds_toggle(LEDS_YELLOW);
+
printf("toggled LEDs\n");
}
static struct etimer timer;
static char i;
- for(i = 0; 1; i++) {
+ for(i = 1; 1; i++) {
PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event && data == &button_sensor);
// debounce for 250 ms