bernadette betreyel
/
TestVirtualisation
bayern
main.cpp@0:76148ffba877, 2019-01-15 (annotated)
- Committer:
- Sidibe
- Date:
- Tue Jan 15 15:20:53 2019 +0000
- Revision:
- 0:76148ffba877
- Child:
- 1:cfd64ae75009
bonjour
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sidibe | 0:76148ffba877 | 1 | #include "mbed.h" |
Sidibe | 0:76148ffba877 | 2 | #include <iostream> |
Sidibe | 0:76148ffba877 | 3 | #include "sigfox.h" |
Sidibe | 0:76148ffba877 | 4 | #include "SoftSerial.h" |
Sidibe | 0:76148ffba877 | 5 | using namespace std; |
Sidibe | 0:76148ffba877 | 6 | |
Sidibe | 0:76148ffba877 | 7 | DigitalOut myled(D2); |
Sidibe | 0:76148ffba877 | 8 | Serial sc(SERIAL_TX, SERIAL_RX, 9600); |
Sidibe | 0:76148ffba877 | 9 | //Serial device(PA_9, PA_10); |
Sidibe | 0:76148ffba877 | 10 | SoftSerial device(PA_4, PA_5); |
Sidibe | 0:76148ffba877 | 11 | //Serial sc2(D5, D4); |
Sidibe | 0:76148ffba877 | 12 | |
Sidibe | 0:76148ffba877 | 13 | |
Sidibe | 0:76148ffba877 | 14 | int main() { |
Sidibe | 0:76148ffba877 | 15 | device.baud(9600); |
Sidibe | 0:76148ffba877 | 16 | sc.printf("---New start ---\r"); |
Sidibe | 0:76148ffba877 | 17 | while (!device.writeable()) { } |
Sidibe | 0:76148ffba877 | 18 | sc.printf("Device writeable\r\n"); |
Sidibe | 0:76148ffba877 | 19 | Sigfox_ mySigfox; |
Sidibe | 0:76148ffba877 | 20 | |
Sidibe | 0:76148ffba877 | 21 | device.printf("AT\r"); |
Sidibe | 0:76148ffba877 | 22 | |
Sidibe | 0:76148ffba877 | 23 | char a = device.getc(); |
Sidibe | 0:76148ffba877 | 24 | char b = device.getc(); |
Sidibe | 0:76148ffba877 | 25 | sc.printf("%c%c \n", a, b); |
Sidibe | 0:76148ffba877 | 26 | sc.printf("%c", device.getc()); |
Sidibe | 0:76148ffba877 | 27 | |
Sidibe | 0:76148ffba877 | 28 | |
Sidibe | 0:76148ffba877 | 29 | uint8_t i = 0; |
Sidibe | 0:76148ffba877 | 30 | |
Sidibe | 0:76148ffba877 | 31 | char res[]= {'1','1','2','2','3','4','1','6','4','2'}; |
Sidibe | 0:76148ffba877 | 32 | int res_[]= {1,1,2,2,3,4,1,6,6,2}; |
Sidibe | 0:76148ffba877 | 33 | char res_1[]= {'a', 'b', 'c'}; |
Sidibe | 0:76148ffba877 | 34 | int var = 1; |
Sidibe | 0:76148ffba877 | 35 | |
Sidibe | 0:76148ffba877 | 36 | char donnee[] = "AT$SF="; |
Sidibe | 0:76148ffba877 | 37 | //char send[] = "123456789098"; |
Sidibe | 0:76148ffba877 | 38 | device.printf(donnee); |
Sidibe | 0:76148ffba877 | 39 | device.printf("%x",79); |
Sidibe | 0:76148ffba877 | 40 | //wait_ms(100); |
Sidibe | 0:76148ffba877 | 41 | device.printf("%x",3249981468); |
Sidibe | 0:76148ffba877 | 42 | // wait_ms(100); |
Sidibe | 0:76148ffba877 | 43 | device.printf("%x",3258733844); |
Sidibe | 0:76148ffba877 | 44 | device.printf("\r"); |
Sidibe | 0:76148ffba877 | 45 | |
Sidibe | 0:76148ffba877 | 46 | char temp; |
Sidibe | 0:76148ffba877 | 47 | do{ |
Sidibe | 0:76148ffba877 | 48 | wait(1.0); |
Sidibe | 0:76148ffba877 | 49 | temp = device.getc(); |
Sidibe | 0:76148ffba877 | 50 | sc.printf("%c%", temp); |
Sidibe | 0:76148ffba877 | 51 | } while(temp != ';'); |
Sidibe | 0:76148ffba877 | 52 | |
Sidibe | 0:76148ffba877 | 53 | |
Sidibe | 0:76148ffba877 | 54 | |
Sidibe | 0:76148ffba877 | 55 | sc.printf("hhh"); |
Sidibe | 0:76148ffba877 | 56 | |
Sidibe | 0:76148ffba877 | 57 | while(1) { |
Sidibe | 0:76148ffba877 | 58 | if(device.readable() > 0){ |
Sidibe | 0:76148ffba877 | 59 | temp = device.getc(); |
Sidibe | 0:76148ffba877 | 60 | wait(3.0); |
Sidibe | 0:76148ffba877 | 61 | sc.printf("%c%", temp); |
Sidibe | 0:76148ffba877 | 62 | } |
Sidibe | 0:76148ffba877 | 63 | myled = 1; |
Sidibe | 0:76148ffba877 | 64 | wait(0.2); |
Sidibe | 0:76148ffba877 | 65 | myled = 0; |
Sidibe | 0:76148ffba877 | 66 | wait(1.0); |
Sidibe | 0:76148ffba877 | 67 | } |
Sidibe | 0:76148ffba877 | 68 | } |
Sidibe | 0:76148ffba877 | 69 |