can のテストプログラム これは動く

Dependencies:   mbed

Fork of RS485113D by albatross

main.cpp

Committer:
YusukeWakuta
Date:
2015-12-04
Revision:
1:d593f210a376
Parent:
0:b24d434c03b7
Child:
2:0302f6a98ff0

File content as of revision 1:d593f210a376:

//送信側
#include "mbed.h"

Serial rs485(p9,p10);
Serial pc(USBTX,USBRX);

DigitalOut Driver(p5);

//int message1 = 0;
//int message2 = 0;
int loopcounter = 0;

int main(){
    rs485.baud(38400);
    Driver = 1;
    while(1){
          loopcounter++;//byteで宣言したほうがいいかも
   int analog_num1 = ((loopcounter / 10) * 10) % 150;
int analog_num2 = ((loopcounter / 10) * 10) % 150;
//putcがうまくいきにくい感がある
  rs485.printf("A");
   rs485.putc(analog_num1);
   pc.printf("%d\n\r",analog_num2);
   rs485.printf("B");
   rs485.putc(analog_num2);
   //pc.printf("%d\n\r",analog_num2);
   wait_ms(50);
        }
}