Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MPU9250_SPI SDFileSystem XBeeLib
event.cpp
- Committer:
- Muglug
- Date:
- 2017-10-17
- Revision:
- 11:f19020fa18f1
- Parent:
- 10:577e1fc4453e
File content as of revision 11:f19020fa18f1:
/* * Los Putacos * Copyright (C) 2017, All rights reserved. * ________________________________________ * * Created by: Gustavo Campana, Michael Schmidt, Miguel Lopez * Date: 12-Oct-2017 * Version: V0.1 */ #include "mbed.h" #include "event.h" /* void print_stinrg(char c = '*') { pc.putc(c); } */ /* void print_event(void const *argv, int i) { pc.printf("%d ",i); pc.printf((const char*)argv); pc.printf("\r\n"); } */ /* void blink_event(DigitalOut pin){ pin = 1; */ void readIMU(){ //imu.resetMPU9250(); pc.printf("%d\r\r ",time_stamp.read()); } void TransmitRequest() //(const char* command, const char* data, int length) { int tmp = 22; // length (grandeur du data à envoyer) 4 (API(1), FrameID(1), AT Command(2)) char* trm = new char[tmp]; // 4 (Delimiter(1), Length(2), Checksum(1)) trm[0] = 0x7E; // Start Delimiter // trm[1] = static_cast<char>((tmp >> 8) & 0xFF); // MSB de length // trm[2] = static_cast<char>(tmp & 0xFF); // LSB length trm[1] = 0x00; // Length 1 trm[2] = 0x12; // Length 2 trm[3] = 0x10; // Frame Type trm[4] = 0x01; // Frame ID // 64-bit Destination Address trm[5] = 0x00; trm[6] = 0x00; trm[7] = 0x00; trm[8] = 0x00; trm[9] = 0x00; trm[10] = 0x00; trm[11] = 0x00; trm[12] = 0x00; // 16-bit Destination Address trm[13] = 0xFF; trm[14] = 0xFE; trm[15] = 0x00; // Broadcast Radius trm[16] = 0x00; // Options // RF Data trm[17] = 0x48; // H trm[18] = 0x6F; // o trm[19] = 0x6C; // l trm[20] = 0x61; // a trm[21] = 0x6D; // Checksum // for (int i = 0; i < length; i++) // trm[7+i] = data[i]; //Data // trm[7+length] = crc8(trm, tmp + 3); Serial xbee(tx, rx); for (int i = 0; i < tmp; i++) xbee.putc(trm[i]); //Transmition des donnees wait(0.01); delete trm; }