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: DataControl
Revision 4:d4c9f57a98c6, committed 2022-09-30
- Comitter:
- ikarashikota
- Date:
- Fri Sep 30 04:30:33 2022 +0000
- Parent:
- 3:906335cad175
- Child:
- 5:664bd71935c3
- Commit message:
- :-):-):-):-)
Changed in this revision
| DataControl.lib | Show annotated file Show diff for this revision Revisions of this file |
| ikarashiCAN.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/DataControl.lib Fri Sep 09 07:17:01 2022 +0000 +++ b/DataControl.lib Fri Sep 30 04:30:33 2022 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/NHK-Robocon2016_Nagaoka_B_Team/code/DataControl/#65149aeacbcc +https://os.mbed.com/teams/NHK-Robocon2016_Nagaoka_B_Team/code/DataControl/#d37d53d33f0d
--- a/ikarashiCAN.h Fri Sep 09 07:17:01 2022 +0000
+++ b/ikarashiCAN.h Fri Sep 30 04:30:33 2022 +0000
@@ -13,13 +13,12 @@
/*サンプルコード
2台のCANを使って通信するヤツです。
+
#include "mbed.h"
#include "ikarashiCAN.h"
Serial pc(USBTX,USBRX,115200);
-
InterruptIn button(USER_BUTTON);
-DigitalOut led(LED2);
Ticker ticker;
//ikarashiCAN ican1(D15, D14, 1, 50000); //sender
@@ -27,29 +26,28 @@
ikarashiCAN ican2(D4, D10, 2, 50000); //reciever
uint16_t data = 0;
+//bool btnFlag = 0;
void pushed(){
- ican1.setData(999999);
+ //btnFlag = !btnFlag;
+ data+=12;
}
-void add(){
- led = !led;
-
- data++;
+void can_update(){
+ ican2.recieve();
ican1.setData(data);
}
int main()
{
- ticker.attach(&add, 1);
ican1.startSend(0.1);
- ican2.startRecieve();
- led = 1;
+
button.mode(PullDown);
while(1){
button.fall(&pushed);
+ can_update();
pc.printf("sdata: %d rdata: %d len: %d s: %d r: %d\n\r", data,ican2.simpleGetData(1), ican2.CanLen(), ican1.checkSender(), ican2.checkReciever());
}
@@ -71,7 +69,7 @@
* @param frequency CANの周波数
* @note nucleoでやる場合、frequencyは50000にしないとなぜか安定しません。
* なので、frequencyを設定しなかったとき自動的に周波数が50000に設定されるようにしました。
- * もっといい方法があるかも...
+ *
*/
ikarashiCAN(PinName rd, PinName td, int msgID, int frequency);
ikarashiCAN(PinName rd, PinName td, int msgID);