Project

General

Profile

Revision 1223

Added by Rich Hong almost 12 years ago

Fast Slave, Working

View differences:

branches/encoders/code/behaviors/spline/slave/slave.c
2 2
#include <wireless.h>
3 3

  
4 4
#define GROUP 1
5
#define TYPE 0
5
#define MOTOR 0
6
#define ENCODER 1
6 7

  
7 8
#define LS 0
8 9
#define LD 1
......
27 28
 * high_left low_left high_right low_right 
28 29
 */
29 30
void packet_receive (char type, int source, unsigned char* packet, int length) {
31
	if (type != MOTOR) return;
30 32
	//orb_set_color(WHITE);
31 33
	usb_puts("receiving\n");
32 34
	sprintf(buf, "%d %d %d %d\n", packet[LS], packet[LD], packet[RS], packet[RD]);
......
59 61
		encoder[L0] = (encoder_left) & 0xFF;
60 62
		encoder[H1] = (encoder_right >> 8) & 0xFF;
61 63
		encoder[L1] = (encoder_right) & 0xFF;
62
		wl_send_global_packet(GROUP, TYPE, encoder, 4, 0);
64
		wl_send_global_packet(GROUP, ENCODER, encoder, 4, 0);
63 65
		usb_puts("Sent ");
64 66
		usb_puti(count++);
65 67
		usb_puts("\n");
66 68

  
67
		delay_ms(200);
69
		delay_ms(10);
68 70
	}
69 71
}
70 72

  

Also available in: Unified diff