Test the HalfDuplex library bypassing the MX12 library
Dependencies: mbed-src
Fork of MX106-custom by
Revision 3:d44622fe4fac, committed 2016-04-28
- Comitter:
- dconsoli
- Date:
- Thu Apr 28 11:14:00 2016 +0000
- Parent:
- 2:1a112ed93ba1
- Commit message:
- Test the halfduplex library bypassing the MX12 library
Changed in this revision
AX12.lib | Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/AX12.lib Tue Apr 26 16:51:04 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://developer.mbed.org/teams/Team-DIANA/code/AX12_v2/#04c4615a2221
--- a/main.cpp Tue Apr 26 16:51:04 2016 +0000 +++ b/main.cpp Thu Apr 28 11:14:00 2016 +0000 @@ -1,16 +1,46 @@ #include "mbed.h" -#include "AX12.h" +#include "SerialHalfDuplex.h" + +// connettere insieme D2, D8, Rpu_5V=10kohm e MX106_data +Serial pc(SERIAL_TX, SERIAL_RX); +SerialHalfDuplex MX106(PA_9, PA_10); + int main() { - Serial pc(USBTX, USBRX); - AX12 MX106(PA_0, PA_1, 1); - pc.printf("Start run!"); - + pc.printf("Si comincia \n"); + /* + pc.printf("Scrivo il comando di accensione LED \n"); + + MX106.putc(0xFF); + MX106.putc(0xFF); + MX106.putc(0x01); + MX106.putc(0x04); + MX106.putc(0x03); + MX106.putc(0x19); + MX106.putc(0x01); + MX106.putc(0xDD); - while (1) { - - pc.printf("%f",MX106.GetTemp()); - - - } + while (1) { + if(MX106.readable()){ + pc.printf("ricevuto %c \n", MX106.getc()); + } + } + */ + + pc.printf("Scrivo il comando di lettura temperatura \n"); + + MX106.putc(0xFF); + MX106.putc(0xFF); + MX106.putc(0x01); + MX106.putc(0x04); + MX106.putc(0x02); + MX106.putc(0x2B); + MX106.putc(0x01); + MX106.putc(0xCC); + + while (1) { + if(MX106.readable()){ + pc.printf("ricevuto %c \n", MX106.getc()); + } + } } \ No newline at end of file