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.
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 00004 Ticker timer; 00005 CAN can1(PA_11,PA_12); 00006 CAN can2 (PB_12,PB_13); 00007 char d[]="12345678"; 00008 TextLCD lcd(D7,D6, D5, D4, D3, D2, TextLCD::LCD16x2); // rs, e, d4-d7 00009 CANMessage msg; 00010 00011 void enviar() 00012 { 00013 can1.write(CANMessage(400,d,8));// método CANMessage para enviar mensaje 00014 } 00015 void leer() 00016 { 00017 if(can2.read(msg)) 00018 { 00019 // lcd.printf("Len: %d\t", msg.len); 00020 // lcd.printf("ID: %d\n", msg.id); 00021 /* lcd.printf("Dato 1 recibido: %d\n\n", msg.data[0]); 00022 lcd.cls(); 00023 lcd.printf("Dato 2 Recibido: %d\t", msg.data[1]); 00024 lcd.cls(); 00025 00026 lcd.printf("Dato 3 Recibido: %d\n\n", msg.data[2]); 00027 lcd.cls(); 00028 00029 lcd.printf("Dato 4 Recibido: %d\n\n", msg.data[3]); 00030 lcd.cls(); 00031 00032 lcd.printf("Dato 5 Recibido: %d\n\n", msg.data[4]); 00033 lcd.cls(); 00034 00035 lcd.printf("Dato 6 Recibido: %d\n\n", msg.data[5]); 00036 lcd.cls(); 00037 00038 lcd.printf("Dato 7 Recibido: %d\n\n", msg.data[6]); 00039 lcd.cls(); 00040 00041 lcd.printf("Dato 8 Recibido: %d\n\n", msg.data[7]); 00042 lcd.cls();*/ 00043 00044 00045 00046 00047 return; 00048 } 00049 } 00050 00051 00052 int main() 00053 { 00054 lcd.printf("HOLA MUNDO"); 00055 //timer.attach(&enviar, 5); 00056 // can2.attach(&leer,CAN::RxIrq); 00057 00058 while(1) 00059 { 00060 00061 } 00062 }
Generated on Tue Jul 12 2022 17:22:20 by
1.7.2