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.
Revision 0:0b8fa7afeb70, committed 2022-06-17
- Comitter:
- invert
- Date:
- Fri Jun 17 13:33:03 2022 +0000
- Commit message:
- committt
Changed in this revision
| main.c | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.c Fri Jun 17 13:33:03 2022 +0000
@@ -0,0 +1,34 @@
+#include <mbed.h>
+
+Ticker ticker;
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+CAN can1(PB_8, PB9_9);
+//CAN can2(p30, p29);
+char counter = 0;
+
+void send()
+{
+ printf("send()\n");
+ if(can1.write(CANMessage(1337, &counter, 1))) {
+ printf("wloop()\n");
+ counter++;
+ printf("Message sent: %d\n", counter);
+ }
+ led1 = !led1;
+}
+
+int main()
+{
+ printf("main()\n");
+ ticker.attach(&send, 1);
+ CANMessage msg;
+ while(1) {
+ printf("loop()\n");
+ if(can1.read(msg)) {
+ printf("Message received: %d\n", msg.data[0]);
+ led2 = !led2;
+ }
+ wait(0.2);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jun 17 13:33:03 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/82220227f4fa \ No newline at end of file