Mohamed Sidibe / Mbed 2 deprecated TestVirtualisation

Dependencies:   mbed SoftSerial Sigfox_Com SoftSerial_IR

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include <iostream>
00003 #include "sigfox.h"
00004 #include "SoftSerial.h"
00005 using namespace std;
00006 
00007 DigitalOut myled(D2);
00008 Serial sc(SERIAL_TX, SERIAL_RX, 9600);
00009 //Serial device(PA_9, PA_10);
00010 SoftSerial device(PA_4, PA_5);
00011 //Serial sc2(D5, D4);
00012 
00013 
00014 int main() {
00015     device.baud(9600);
00016     sc.printf("---New start ---\r");
00017     while (!device.writeable()) { }
00018     sc.printf("Device writeable\r\n");
00019     Sigfox_ mySigfox;
00020     
00021     device.printf("AT\r");
00022 
00023     char a = device.getc();
00024     char b = device.getc();
00025     sc.printf("%c%c \n", a, b);
00026     sc.printf("%c", device.getc());
00027    
00028     
00029     uint8_t i = 0;
00030     
00031     char res[]= {'1','1','2','2','3','4','1','6','4','2'};
00032     int res_[]= {1,1,2,2,3,4,1,6,6,2};
00033     char res_1[]= {'a', 'b', 'c'};
00034     int var = 1;
00035     
00036     char donnee[] = "AT$SF=";
00037     //char send[] = "123456789098";
00038     device.printf(donnee);
00039     device.printf("%x",79);
00040     //wait_ms(100);
00041     device.printf("%x",3249981468);
00042    // wait_ms(100);
00043     device.printf("%x",3258733844);
00044     device.printf("\r");
00045 
00046     char temp;
00047     do{
00048         wait(1.0);
00049         temp = device.getc();
00050         sc.printf("%c%", temp);
00051     } while(temp != ';');
00052     
00053     
00054    
00055     sc.printf("hhh");
00056    
00057     while(1) {
00058        if(device.readable() > 0){
00059         temp = device.getc();
00060         wait(3.0);
00061         sc.printf("%c%", temp);
00062        }
00063        myled = 1;
00064        wait(0.2);
00065        myled = 0; 
00066        wait(1.0);
00067     }
00068 }
00069