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
Revision 0:efd2956da873, committed 2016-01-23
- Comitter:
- taurin
- Date:
- Sat Jan 23 17:37:58 2016 +0000
- Commit message:
- 1/24?????can ver??????????
Changed in this revision
main.cpp | 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 |
diff -r 000000000000 -r efd2956da873 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Jan 23 17:37:58 2016 +0000 @@ -0,0 +1,55 @@ +//中央can program + +#include "mbed.h" +#define WAIT_LOOP_TIME 0.1 +#define YOKUTAN_DATAS_NUM 5 +#define IMPUT_DATAS_NUM 2 +#define SEND_DATAS_CAN_ID 100 + +CAN can(p9,p10); +Serial toKeikiSerial(p28,p27); +Serial pc(USBTX,USBRX); +DigitalIn eruron(p7); +DigitalIn drug(p8); + +signed char yokutanDatas[YOKUTAN_DATAS_NUM]; +char inputDatas[IMPUT_DATAS_NUM]; + +void InputAndSentControlValues(){ + inputDatas[0] = eruron; + inputDatas[1] = drug; + for(int i = 0; i < IMPUT_DATAS_NUM; i++){ + if(can.write(CANMessage(SEND_DATAS_CAN_ID, inputDatas, IMPUT_DATAS_NUM))){ + pc.printf("send successed!\n\r"); + } + } +} + +void SendDarasToKeiki(){ + for(int i = 0; i < YOKUTAN_DATAS_NUM; i++){ + toKeikiSerial.putc(yokutanDatas[i]); + } +} + +void toString(){ + for(int i = 0; i < YOKUTAN_DATAS_NUM; i++){ + pc.printf("%i:",yokutanDatas[i]); + } + pc.printf("\n\r"); +} + +void init(){ +} + +int main(){ + init(); + while(1){ + InputAndSentControlValues(); + wait_us(10); + if(can.read(recmsg)){ + receiveDatas(); + } + toString(); + wait(WAIT_LOOP_TIME); + } +} \ No newline at end of file
diff -r 000000000000 -r efd2956da873 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Jan 23 17:37:58 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/165afa46840b \ No newline at end of file