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.
Dependencies: mbed
main.cpp
- Committer:
- maxnagazumi
- Date:
- 2021-12-15
- Revision:
- 1:f0e74f06b93b
- Parent:
- 0:33432ad74af7
File content as of revision 1:f0e74f06b93b:
#include "mbed.h" Serial pc(USBTX, USBRX); CAN can1(p30,p29); //CAN can1(PB_5,PB_13); Ticker ticker; DigitalOut led1(LED1); //DigitalOut led2(LED2); //DigitalOut led3(LED3); //DigitalOut led4(LED4); char can_data1[1]; int data1=10; CANMessage msg1; void cansend() { can_data1[0]=data1&255; if(can1.write(CANMessage(0,can_data1,1))) { led1=1; //led2=0; //led3=0; //led4=0; pc.printf("can1 send\r\n"); } else { led1=0; pc.printf("can1 no send\r\n"); } } int main() { led1=1; /*led2=1; led3=1; led4=1;*/ wait(0.5); led1=0; /*led2=0; led3=0; led4=0;*/ can1.frequency(1000000); ticker.attach(&cansend,0.001); }