Team DIANA / Mbed 2 deprecated MX106_need_transciver

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 //------------------------------------
00004 // Hyperterminal configuration
00005 // 9600 bauds, 8-bit data, no parity
00006 //------------------------------------
00007 
00008 Serial pc(SERIAL_TX, SERIAL_RX);
00009 Serial MX106(PA_9, PA_10);
00010 DigitalOut data_control(PB_5);
00011  
00012 int main() {
00013   data_control = 0; //abilito la linea per la lettura
00014    pc.printf("Si comincia \n");
00015   /*
00016   pc.printf("Scrivo il comando di accensione LED \n");
00017   
00018     data_control = 1;
00019   
00020   MX106.putc(0xFF);
00021   MX106.putc(0xFF);
00022   MX106.putc(0x01);
00023   MX106.putc(0x04);
00024   MX106.putc(0x03);
00025   MX106.putc(0x19);
00026   MX106.putc(0x01);
00027   MX106.putc(0xDD); 
00028   
00029     data_control = 0;
00030    
00031    while (1) { 
00032     if(MX106.readable()){                
00033       pc.printf("ricevuto %c \n", MX106.getc());        
00034      }
00035     }   
00036     */ 
00037     
00038     pc.printf("Scrivo il comando di lettura temperatura \n");
00039     
00040       data_control = 1;
00041   
00042   MX106.putc(0xFF);
00043   MX106.putc(0xFF);
00044   MX106.putc(0x01);
00045   MX106.putc(0x04);
00046   MX106.putc(0x02);
00047   MX106.putc(0x2B);
00048   MX106.putc(0x01);
00049   MX106.putc(0xCC); 
00050   
00051     data_control = 0;
00052    
00053    while (1) { 
00054     if(MX106.readable()){                
00055       pc.printf("ricevuto %c \n", MX106.getc());        
00056      }
00057     }   
00058 }
00059 
00060