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: ds3_si mbed omuni solenoid
Fork of 2017_Robocon_mother by
Diff: main.cpp
- Revision:
- 5:d5aa02f1acbb
- Parent:
- 3:2d189409c3c3
- Child:
- 6:f5f0b60cd380
--- a/main.cpp Tue Oct 10 12:51:10 2017 +0000 +++ b/main.cpp Wed Oct 11 04:33:26 2017 +0000 @@ -1,9 +1,9 @@ - #include "mbed.h" #include "omuni.h" -#include "mbed.h" #include "solenoid.h" +//#define DEBUG + I2C i2c(p28, p27); omuni omu(&i2c, 0x10, 0x14, 0x16); solenoid sol(&i2c, 0x20); @@ -12,7 +12,7 @@ Serial master(p13,p14); Serial pc(USBTX, USBRX); -int ConData[2][12]; +char ConData[2][12]; void GetData() @@ -50,7 +50,11 @@ char MotorData[] = {'H', ConData[0][1]-1, ConData[0][2]-6, ConData[1][1]+1, ConData[1][2]-8}; omu.out(MotorData); - + + char soldata = ((ConData[0][3] << 2) + ConData[1][3]) << 4; + sol = soldata; + + #ifdef DEBUG for(int i = 0; i < 12; i++) { pc.printf("%3d ",ConData[0][i]); @@ -61,8 +65,8 @@ } pc.printf("\n\r"); - char soldata = ((ConData[0][3] << 2) + ConData[1][3]) << 4; - //printf("%d\n",soldata); - sol = soldata; + printf("%d\n",soldata); + #endif + } }