Table controller for piswarm-office

Dependencies:   mbed

Fork of PiSwarmTableController by piswarm

Committer:
hee502
Date:
Thu Aug 14 09:06:31 2014 +0000
Revision:
5:68a1ce96bfeb
Parent:
4:3cbff30b7b7b
Table controller for piswarm-office

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hee502 4:3cbff30b7b7b 1 //TABLE CONTROLLER
hee502 4:3cbff30b7b7b 2 //-Reads Sensors
hee502 4:3cbff30b7b7b 3 //-Decides table target position & movement speed
hee502 4:3cbff30b7b7b 4 //-Sends data via RF
jah128 0:d88fd55a27a6 5
jah128 0:d88fd55a27a6 6 #include "mbed.h"
jah128 2:c81f4ef63132 7 #include "main.h"
jah128 2:c81f4ef63132 8 #include "communications.h"
jah128 0:d88fd55a27a6 9 #include "display.h" //Display driver for the Midas 16x2 I2C Display
hee502 5:68a1ce96bfeb 10 LocalFileSystem local("local");
hee502 4:3cbff30b7b7b 11 //OBJECTS
jah128 1:e4a0d424ac8d 12 PwmOut ir_pwm_out(p21); //PWM Output for the IR LED driver
jah128 1:e4a0d424ac8d 13 DigitalOut ir_led(LED1);
jah128 2:c81f4ef63132 14 DigitalOut tx_led(LED3);
jah128 1:e4a0d424ac8d 15 DigitalOut pir_led(LED4);
hee502 5:68a1ce96bfeb 16 DigitalIn input_1(p20);
jah128 1:e4a0d424ac8d 17 AnalogIn input_2(p19);
jah128 1:e4a0d424ac8d 18 DigitalIn input_3(p18);
jah128 1:e4a0d424ac8d 19 DigitalIn input_4(p17);
jah128 1:e4a0d424ac8d 20 DigitalIn input_5(p16);
jah128 1:e4a0d424ac8d 21 DigitalIn input_6(p15);
jah128 2:c81f4ef63132 22 Serial pc (USBTX, USBRX);
jah128 0:d88fd55a27a6 23 Display display;
jah128 2:c81f4ef63132 24 Alpha433 rf;
jah128 3:bc7a0f14b28a 25 Timer ir_led_timer; //System timer is used for timer the on-off periods for the LEDs
jah128 3:bc7a0f14b28a 26 Timer command_timer; //Timer for sending rf messages
jah128 1:e4a0d424ac8d 27 Ticker polling_ticker; //Ticker for polling the input sensors
hee502 4:3cbff30b7b7b 28 Ticker sound_ticker;
jah128 0:d88fd55a27a6 29
hee502 4:3cbff30b7b7b 30 //VARIABLES
jah128 3:bc7a0f14b28a 31 int off_period = 975000; //Off-period for the IR LEDs in microseconds
jah128 3:bc7a0f14b28a 32 int on_period = 25000; //On-period for the IR LEDs in microseconds
jah128 2:c81f4ef63132 33 char power = 1; //Output power for the IR LEDs : 0=25%, 1=50%, 2=75%, 3=100% (700mA) [NB The LEDs are rated 20mA and are in parallel runs of 20, so a maximum power of 50% is recommended for long term use]
jah128 2:c81f4ef63132 34 char use_ir_leds = 1; //Set to 0 to disable IR LEDs, 1 to enable
jah128 2:c81f4ef63132 35 char input_3_active = 0;
jah128 2:c81f4ef63132 36 char input_4_active = 0;
jah128 2:c81f4ef63132 37 char input_5_active = 0;
jah128 2:c81f4ef63132 38 char input_6_active = 0;
jah128 2:c81f4ef63132 39 int input_3_window = 0;
jah128 2:c81f4ef63132 40 int input_4_window = 0;
jah128 2:c81f4ef63132 41 int input_5_window = 0;
jah128 2:c81f4ef63132 42 int input_6_window = 0;
jah128 2:c81f4ef63132 43 float polling_rate = 0.1; // Period in seconds to poll sensors
jah128 2:c81f4ef63132 44 int polling_decay = 300; // Number of polls to decrement counters
jah128 2:c81f4ef63132 45 int polling_count = 0;
jah128 0:d88fd55a27a6 46
hee502 4:3cbff30b7b7b 47 float speed = 0;
hee502 4:3cbff30b7b7b 48 int sound = 0;
hee502 5:68a1ce96bfeb 49 float soundLevel = 0.00;
hee502 4:3cbff30b7b7b 50 float soundRaw = 0;
hee502 4:3cbff30b7b7b 51 float soundFiltered = 0;
hee502 4:3cbff30b7b7b 52 float soundFilteredPrev = 0;
hee502 4:3cbff30b7b7b 53 float targetX = 0;
hee502 4:3cbff30b7b7b 54 float targetY = 0;
hee502 4:3cbff30b7b7b 55 char data[13];//0-3:speed, 4:sound, 5-8:targetX, 9-12:targetY
hee502 4:3cbff30b7b7b 56 char * dataP;
hee502 5:68a1ce96bfeb 57 char text[17];
hee502 5:68a1ce96bfeb 58 char *textP = &text[0];
hee502 4:3cbff30b7b7b 59 int level_3 = 0;
hee502 4:3cbff30b7b7b 60 int level_4 = 0;
hee502 4:3cbff30b7b7b 61 int level_5 = 0;
hee502 4:3cbff30b7b7b 62 int level_6 = 0;
hee502 5:68a1ce96bfeb 63 int pir[3];
hee502 5:68a1ce96bfeb 64 int fileCount = 0;
hee502 5:68a1ce96bfeb 65 char fileName[50];
hee502 5:68a1ce96bfeb 66
hee502 5:68a1ce96bfeb 67 FILE *fp;
hee502 4:3cbff30b7b7b 68
hee502 4:3cbff30b7b7b 69 //int counter = 0;//for Edgar to try effect of sound change
hee502 4:3cbff30b7b7b 70
hee502 4:3cbff30b7b7b 71 //PROTOTYPES
hee502 4:3cbff30b7b7b 72 void broadcast_user_rf_command(int function, char * message, int length);
hee502 4:3cbff30b7b7b 73 int get_output_power();
hee502 4:3cbff30b7b7b 74 void polling();
hee502 4:3cbff30b7b7b 75 void soundReading();
hee502 4:3cbff30b7b7b 76
hee502 4:3cbff30b7b7b 77 int main()
hee502 4:3cbff30b7b7b 78 {
hee502 4:3cbff30b7b7b 79 init();
hee502 4:3cbff30b7b7b 80 char phase = 0;
hee502 4:3cbff30b7b7b 81 char motor_step = 0;
hee502 5:68a1ce96bfeb 82 pc.baud(9600);
hee502 5:68a1ce96bfeb 83 //pc.printf("hello");
hee502 4:3cbff30b7b7b 84 ir_led_timer.start();
hee502 4:3cbff30b7b7b 85 ir_pwm_out.period_us(1000);
hee502 4:3cbff30b7b7b 86 ir_pwm_out.pulsewidth_us(0);
hee502 4:3cbff30b7b7b 87 polling_ticker.attach(&polling,0.2);
hee502 4:3cbff30b7b7b 88 soundFiltered = 3400.00;//R17=137K, background~3400
hee502 5:68a1ce96bfeb 89 sound_ticker.attach(&soundReading,1.0);
hee502 5:68a1ce96bfeb 90
hee502 4:3cbff30b7b7b 91 while(1) {
hee502 4:3cbff30b7b7b 92 if(command_timer.read_us() > 500000){
hee502 4:3cbff30b7b7b 93 command_timer.reset();
hee502 4:3cbff30b7b7b 94 motor_step ++;
hee502 4:3cbff30b7b7b 95 if(motor_step > 4) motor_step = 0;
hee502 4:3cbff30b7b7b 96 switch(motor_step){
hee502 4:3cbff30b7b7b 97 case 0: broadcast_user_rf_command(0,"Hello",5);break;
hee502 4:3cbff30b7b7b 98 case 1: broadcast_user_rf_command(1,"there",5);break;
hee502 4:3cbff30b7b7b 99 case 2: broadcast_user_rf_command(2,"you",3);break;
hee502 4:3cbff30b7b7b 100 case 3: broadcast_user_rf_command(3,"munters",7);break;
hee502 4:3cbff30b7b7b 101 }
hee502 4:3cbff30b7b7b 102 }
hee502 4:3cbff30b7b7b 103 if(phase==0){//IRs OFF
hee502 4:3cbff30b7b7b 104 if(ir_led_timer.read_us() >= off_period){
hee502 4:3cbff30b7b7b 105 ir_led_timer.reset();
hee502 4:3cbff30b7b7b 106 int pw = get_output_power();
hee502 4:3cbff30b7b7b 107 if(use_ir_leds) ir_pwm_out.pulsewidth_us(pw);
hee502 4:3cbff30b7b7b 108 ir_led=1;
hee502 4:3cbff30b7b7b 109 phase = 1;
hee502 4:3cbff30b7b7b 110 }
hee502 4:3cbff30b7b7b 111 }else{//IRs ON
hee502 4:3cbff30b7b7b 112 if(ir_led_timer.read_us() >= on_period){
hee502 4:3cbff30b7b7b 113 ir_led_timer.reset();
hee502 4:3cbff30b7b7b 114 ir_pwm_out.pulsewidth_us(0);
hee502 4:3cbff30b7b7b 115 ir_led=0;
hee502 4:3cbff30b7b7b 116 phase = 0;
hee502 4:3cbff30b7b7b 117 }
hee502 4:3cbff30b7b7b 118 }
hee502 4:3cbff30b7b7b 119 }
hee502 4:3cbff30b7b7b 120 }
hee502 4:3cbff30b7b7b 121
jah128 3:bc7a0f14b28a 122 void broadcast_user_rf_command(int function, char * message, int length)
jah128 0:d88fd55a27a6 123 {
jah128 3:bc7a0f14b28a 124 //This function augments the communications stack
jah128 3:bc7a0f14b28a 125 //It sends a 'user' RF command to all members (ie target_id = 0)
jah128 3:bc7a0f14b28a 126 //It sends a 'request', not a 'command', meaning it will still be handled if commands are disabled (RF_ALLOW_COMMANDS set to 0, recommended)
jah128 3:bc7a0f14b28a 127 //It takes three inputs:
jah128 3:bc7a0f14b28a 128 // * function (an integer from 0 to 15)
jah128 3:bc7a0f14b28a 129 // * message (a char array)
jah128 3:bc7a0f14b28a 130 // * length (length of message in bytes)
jah128 3:bc7a0f14b28a 131 send_rf_message(0,48+(function % 16),message,length);
jah128 0:d88fd55a27a6 132 }
jah128 3:bc7a0f14b28a 133
jah128 0:d88fd55a27a6 134
jah128 1:e4a0d424ac8d 135 int get_output_power(){
jah128 1:e4a0d424ac8d 136 switch(power){
jah128 1:e4a0d424ac8d 137 case 1: return 500;
jah128 1:e4a0d424ac8d 138 case 2: return 750;
jah128 1:e4a0d424ac8d 139 case 3: return 1000;
jah128 1:e4a0d424ac8d 140 }
jah128 1:e4a0d424ac8d 141 return 250;
jah128 0:d88fd55a27a6 142 }
jah128 0:d88fd55a27a6 143
jah128 1:e4a0d424ac8d 144 void polling(){
hee502 4:3cbff30b7b7b 145 /*Movement*/
hee502 5:68a1ce96bfeb 146 pir[0] = input_3.read();
hee502 5:68a1ce96bfeb 147 if(pir[0] == 1){
hee502 4:3cbff30b7b7b 148 if(level_3 < 10){
hee502 4:3cbff30b7b7b 149 level_3++;
hee502 4:3cbff30b7b7b 150 }
hee502 4:3cbff30b7b7b 151 }
hee502 4:3cbff30b7b7b 152 else{
hee502 4:3cbff30b7b7b 153 if(level_3 > 0){
hee502 4:3cbff30b7b7b 154 level_3--;
hee502 4:3cbff30b7b7b 155 }
hee502 4:3cbff30b7b7b 156 }
hee502 5:68a1ce96bfeb 157 pir[1] = input_4.read();
hee502 5:68a1ce96bfeb 158 if(pir[1] == 1){
hee502 4:3cbff30b7b7b 159 if(level_4 < 10){
hee502 4:3cbff30b7b7b 160 level_4++;
hee502 4:3cbff30b7b7b 161 }
hee502 4:3cbff30b7b7b 162 }
hee502 4:3cbff30b7b7b 163 else{
hee502 4:3cbff30b7b7b 164 if(level_4 > 0){
hee502 4:3cbff30b7b7b 165 level_4--;
hee502 4:3cbff30b7b7b 166 }
hee502 4:3cbff30b7b7b 167 }
hee502 5:68a1ce96bfeb 168 pir[2] = input_5.read();
hee502 5:68a1ce96bfeb 169 if(pir[2] == 1){
hee502 4:3cbff30b7b7b 170 if(level_5 < 10){
hee502 4:3cbff30b7b7b 171 level_5++;
hee502 4:3cbff30b7b7b 172 }
hee502 4:3cbff30b7b7b 173 }
hee502 4:3cbff30b7b7b 174 else{
hee502 4:3cbff30b7b7b 175 if(level_5 > 0){
hee502 4:3cbff30b7b7b 176 level_5--;
hee502 4:3cbff30b7b7b 177 }
hee502 4:3cbff30b7b7b 178 }
hee502 4:3cbff30b7b7b 179 speed = level_3 + level_4 + level_5;
hee502 4:3cbff30b7b7b 180 speed /= 3.0;
hee502 4:3cbff30b7b7b 181 speed /= 10.0;
hee502 4:3cbff30b7b7b 182 speed *= 0.15;
hee502 4:3cbff30b7b7b 183 speed += 0.05;
hee502 4:3cbff30b7b7b 184 targetX = 0.5 - level_4 * 0.05;
hee502 4:3cbff30b7b7b 185 targetY = 0.5 + level_3 * 0.05;
hee502 4:3cbff30b7b7b 186 targetY = 0.5 - level_5 * 0.05;
hee502 4:3cbff30b7b7b 187
hee502 4:3cbff30b7b7b 188 snprintf(data,13,"%0.2f%c%0.2f%0.2f", speed, sound, targetX, targetY);
hee502 4:3cbff30b7b7b 189 char * dataP = &data[0];
hee502 4:3cbff30b7b7b 190 broadcast_user_rf_command(0, dataP, 13);
hee502 4:3cbff30b7b7b 191 display.clear_display();
hee502 4:3cbff30b7b7b 192 display.write_string(dataP,14);
hee502 4:3cbff30b7b7b 193
hee502 4:3cbff30b7b7b 194 /*Sound*/
hee502 4:3cbff30b7b7b 195 snprintf(data,15,"%0.2f %d",soundFiltered,sound);
hee502 4:3cbff30b7b7b 196 display.set_position(1,0);//2nd line
hee502 4:3cbff30b7b7b 197 display.write_string(dataP,16);
hee502 4:3cbff30b7b7b 198
hee502 4:3cbff30b7b7b 199 /* polling_count ++;
jah128 2:c81f4ef63132 200 char pir_active = 0;
jah128 2:c81f4ef63132 201 char state_changed = 0;
jah128 2:c81f4ef63132 202 if(input_3.read()==1){
jah128 2:c81f4ef63132 203 pir_active = 1;
jah128 2:c81f4ef63132 204 if(input_3_active == 0){
jah128 2:c81f4ef63132 205 state_changed = 1;
jah128 2:c81f4ef63132 206 input_3_active = 1;
jah128 2:c81f4ef63132 207 input_3_window ++;
jah128 2:c81f4ef63132 208 }
jah128 2:c81f4ef63132 209 }else {
jah128 2:c81f4ef63132 210 input_3_active = 0;
jah128 2:c81f4ef63132 211 if(polling_count == polling_decay){
jah128 2:c81f4ef63132 212 input_3_window --;
jah128 2:c81f4ef63132 213 if(input_3_window < 0) input_3_window = 0;
jah128 2:c81f4ef63132 214 }
jah128 2:c81f4ef63132 215 }
jah128 2:c81f4ef63132 216
jah128 2:c81f4ef63132 217 if(input_4.read()==1){
jah128 2:c81f4ef63132 218 pir_active = 1;
jah128 2:c81f4ef63132 219 if(input_4_active == 0){
jah128 2:c81f4ef63132 220 state_changed = 1;
jah128 2:c81f4ef63132 221 input_4_active = 1;
jah128 2:c81f4ef63132 222 input_4_window ++;
jah128 2:c81f4ef63132 223 }
jah128 2:c81f4ef63132 224 }else {
jah128 2:c81f4ef63132 225 input_4_active = 0;
jah128 2:c81f4ef63132 226 if(polling_count == polling_decay){
jah128 2:c81f4ef63132 227 input_4_window --;
jah128 2:c81f4ef63132 228 if(input_4_window < 0) input_4_window = 0;
jah128 2:c81f4ef63132 229 }
jah128 2:c81f4ef63132 230 }
jah128 2:c81f4ef63132 231
jah128 2:c81f4ef63132 232 if(input_5.read()==1){
jah128 2:c81f4ef63132 233 pir_active = 1;
jah128 2:c81f4ef63132 234 if(input_5_active == 0){
jah128 2:c81f4ef63132 235 state_changed = 1;
jah128 2:c81f4ef63132 236 input_5_active = 1;
jah128 2:c81f4ef63132 237 input_5_window ++;
jah128 2:c81f4ef63132 238 }
jah128 2:c81f4ef63132 239 }else {
jah128 2:c81f4ef63132 240 input_5_active = 0;
jah128 2:c81f4ef63132 241 if(polling_count == polling_decay){
jah128 2:c81f4ef63132 242 input_5_window --;
jah128 2:c81f4ef63132 243 if(input_5_window < 0) input_5_window = 0;
jah128 2:c81f4ef63132 244 }
jah128 2:c81f4ef63132 245 }
jah128 2:c81f4ef63132 246
jah128 2:c81f4ef63132 247 if(input_6.read()==1){
jah128 2:c81f4ef63132 248 pir_active = 1;
jah128 2:c81f4ef63132 249 if(input_6_active == 0){
jah128 2:c81f4ef63132 250 state_changed = 1;
jah128 2:c81f4ef63132 251 input_6_active = 1;
jah128 2:c81f4ef63132 252 input_6_window ++;
jah128 2:c81f4ef63132 253 }
jah128 2:c81f4ef63132 254 }else {
jah128 2:c81f4ef63132 255 input_6_active = 0;
jah128 2:c81f4ef63132 256 if(polling_count == polling_decay){
jah128 2:c81f4ef63132 257 input_6_window --;
jah128 2:c81f4ef63132 258 if(input_6_window < 0) input_6_window = 0;
jah128 2:c81f4ef63132 259 }
jah128 2:c81f4ef63132 260 }
jah128 2:c81f4ef63132 261
jah128 2:c81f4ef63132 262 pir_led=pir_active;
jah128 2:c81f4ef63132 263 if(polling_count == polling_decay) {
jah128 2:c81f4ef63132 264 polling_count = 0;
jah128 2:c81f4ef63132 265 state_changed = 1;
jah128 2:c81f4ef63132 266 }
jah128 2:c81f4ef63132 267 if(state_changed == 1){
jah128 2:c81f4ef63132 268 display.clear_display();
jah128 2:c81f4ef63132 269 display.set_position(0,0);
jah128 2:c81f4ef63132 270 char text [17];
jah128 2:c81f4ef63132 271 snprintf(text,17,"3:%i 4:%i 5:%i 6:%i",input_3_window,input_4_window,input_5_window,input_6_window);
jah128 2:c81f4ef63132 272 display.write_string(text,16);
hee502 4:3cbff30b7b7b 273 }*/
hee502 5:68a1ce96bfeb 274 /*sprintf(fileName,"%s%d%s","/local/",fileCount,".txt");
hee502 5:68a1ce96bfeb 275 fp = fopen(fileName, "w");
hee502 5:68a1ce96bfeb 276 snprintf(text,17,"%d,%d,%d,%0.2f,%d\n", pir[0],pir[1],pir[2],speed, sound);
hee502 5:68a1ce96bfeb 277 fprintf(fp, "text/n/r");
hee502 5:68a1ce96bfeb 278 fclose(fp);
hee502 5:68a1ce96bfeb 279 fileCount++;*/
jah128 0:d88fd55a27a6 280 }
jah128 0:d88fd55a27a6 281
hee502 4:3cbff30b7b7b 282 void soundReading(void){
hee502 5:68a1ce96bfeb 283 //soundFilteredPrev = soundFiltered;//save previous value
hee502 5:68a1ce96bfeb 284 //sound = input_1.read_u16();//read new value
hee502 5:68a1ce96bfeb 285 if(input_1){
hee502 5:68a1ce96bfeb 286 soundLevel+=0.1;
hee502 5:68a1ce96bfeb 287 if(soundLevel > 1.0)
hee502 5:68a1ce96bfeb 288 soundLevel = 1.0;
hee502 5:68a1ce96bfeb 289 }
hee502 5:68a1ce96bfeb 290 else{
hee502 5:68a1ce96bfeb 291 soundLevel-=0.07;
hee502 5:68a1ce96bfeb 292 if(soundLevel < 0.00)
hee502 5:68a1ce96bfeb 293 soundLevel = 0.00;
hee502 5:68a1ce96bfeb 294 }
hee502 5:68a1ce96bfeb 295 if(soundLevel > 0.5){
hee502 5:68a1ce96bfeb 296 sound = 1;
hee502 5:68a1ce96bfeb 297 }
hee502 5:68a1ce96bfeb 298 else{
hee502 5:68a1ce96bfeb 299 sound = 0;
hee502 5:68a1ce96bfeb 300 }
hee502 5:68a1ce96bfeb 301 //soundFiltered *= 0.96;//filter new value
hee502 5:68a1ce96bfeb 302 //soundRaw = sound * 0.04;
hee502 5:68a1ce96bfeb 303 //soundFiltered += soundRaw;
hee502 4:3cbff30b7b7b 304 /*if((soundFiltered - soundFilteredPrev) > 10.00)
hee502 4:3cbff30b7b7b 305 soundFiltered = soundFilteredPrev + 10.00;
hee502 4:3cbff30b7b7b 306 if((soundFiltered - soundFilteredPrev) < -10.00)
hee502 5:68a1ce96bfeb 307 soundFiltered = soundFilteredPrev - 10.00;*/
jah128 2:c81f4ef63132 308 }
jah128 2:c81f4ef63132 309
jah128 2:c81f4ef63132 310 void handleUserRFCommand(char sender, char broadcast_message, char request_response, char id, char is_command, char function, char * data, char length){
jah128 2:c81f4ef63132 311 }
jah128 2:c81f4ef63132 312
jah128 2:c81f4ef63132 313 void handleUserRFResponse(char sender, char broadcast_message, char success, char id, char is_command, char function, char * data, char length){
jah128 2:c81f4ef63132 314 }
jah128 2:c81f4ef63132 315
jah128 2:c81f4ef63132 316 void processRawRFData(char * rstring, char cCount){
jah128 2:c81f4ef63132 317 }
jah128 2:c81f4ef63132 318
jah128 2:c81f4ef63132 319
jah128 2:c81f4ef63132 320 void handleData(char * data, char length)
jah128 2:c81f4ef63132 321 {
jah128 2:c81f4ef63132 322 display.set_position(1,1);
jah128 2:c81f4ef63132 323 display.write_string(data,length);
jah128 2:c81f4ef63132 324 }
jah128 3:bc7a0f14b28a 325
jah128 3:bc7a0f14b28a 326
jah128 3:bc7a0f14b28a 327 void init()
jah128 3:bc7a0f14b28a 328 {
jah128 3:bc7a0f14b28a 329 display.init_display();
jah128 3:bc7a0f14b28a 330 display.set_position(0,2);
jah128 3:bc7a0f14b28a 331 display.write_string("YORK ROBOTICS",13);
jah128 3:bc7a0f14b28a 332 display.set_position(1,3);
jah128 3:bc7a0f14b28a 333 display.write_string("LABORATORY",10);
jah128 3:bc7a0f14b28a 334 wait(0.45);
jah128 3:bc7a0f14b28a 335 display.clear_display();
jah128 3:bc7a0f14b28a 336 display.set_position(0,1);
jah128 3:bc7a0f14b28a 337 display.write_string("Pi Swarm Table",14);
jah128 3:bc7a0f14b28a 338 display.set_position(1,3);
jah128 3:bc7a0f14b28a 339 display.write_string("Controller",10);
jah128 3:bc7a0f14b28a 340 wait(0.45);
jah128 3:bc7a0f14b28a 341 rf.rf_init();
jah128 3:bc7a0f14b28a 342 rf.setFrequency(435000000);
jah128 3:bc7a0f14b28a 343 rf.setDatarate(57600);
jah128 3:bc7a0f14b28a 344 }