AT cfommand

Committer:
HarryKeane
Date:
Thu Feb 20 12:50:49 2020 +0000
Revision:
0:428ce6fd8969
Crappy rev 1 ;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
HarryKeane 0:428ce6fd8969 1 #include "mbed.h"
HarryKeane 0:428ce6fd8969 2
HarryKeane 0:428ce6fd8969 3
HarryKeane 0:428ce6fd8969 4 Serial PC(USBTX, USBRX); //This is solelly for PC comms
HarryKeane 0:428ce6fd8969 5 Serial GSM(PD_5, PD_6); //This is solelly for PC comms
HarryKeane 0:428ce6fd8969 6
HarryKeane 0:428ce6fd8969 7
HarryKeane 0:428ce6fd8969 8
HarryKeane 0:428ce6fd8969 9 int main(){
HarryKeane 0:428ce6fd8969 10
HarryKeane 0:428ce6fd8969 11 PC.baud(115200);
HarryKeane 0:428ce6fd8969 12 GSM.baud(9600);
HarryKeane 0:428ce6fd8969 13
HarryKeane 0:428ce6fd8969 14 wait_ms(500);
HarryKeane 0:428ce6fd8969 15
HarryKeane 0:428ce6fd8969 16 PC.printf("Test");
HarryKeane 0:428ce6fd8969 17
HarryKeane 0:428ce6fd8969 18
HarryKeane 0:428ce6fd8969 19
HarryKeane 0:428ce6fd8969 20
HarryKeane 0:428ce6fd8969 21 GSM.printf("AT");
HarryKeane 0:428ce6fd8969 22
HarryKeane 0:428ce6fd8969 23 wait_ms(500);
HarryKeane 0:428ce6fd8969 24
HarryKeane 0:428ce6fd8969 25 printf("start read\n\r");
HarryKeane 0:428ce6fd8969 26
HarryKeane 0:428ce6fd8969 27 while(1) {
HarryKeane 0:428ce6fd8969 28
HarryKeane 0:428ce6fd8969 29 if(GSM.readable()>0) {
HarryKeane 0:428ce6fd8969 30 printf("start\r\n");
HarryKeane 0:428ce6fd8969 31 PC.printf("%c",GSM.getc());
HarryKeane 0:428ce6fd8969 32 printf("\r\nStop\r\n");
HarryKeane 0:428ce6fd8969 33 }
HarryKeane 0:428ce6fd8969 34
HarryKeane 0:428ce6fd8969 35
HarryKeane 0:428ce6fd8969 36 }
HarryKeane 0:428ce6fd8969 37 }