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.
Revision 0:b7708bb00e0c, committed 2017-02-28
- Comitter:
- eil4nyqn
- Date:
- Tue Feb 28 14:10:01 2017 +0000
- Child:
- 1:ab88be7729f6
- Commit message:
- first commit checked running well
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FEP.lib Tue Feb 28 14:10:01 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/NHK-Robocon2016_Nagaoka_B_Team/code/FEP/#bf959a15b079
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Feb 28 14:10:01 2017 +0000
@@ -0,0 +1,75 @@
+#include "mbed.h"
+#include "FEP.h"
+
+BusIn onSW(PA_4,PA_5,PB_5,PB_4,PB_3,PA_15,PA_12);
+BusIn otherSW(PC_13,PC_14,PB_9,PC_15,PA_11,PA_1);
+AnalogIn Stick[4]={PA_6,PA_7,PB_0,PB_1};
+FEP fep(PA_2,PA_3);
+Serial xbee(PA_9,PA_10,38400);
+Serial pc(PB_10,PB_11,115200);
+DigitalOut leds[4]={PB_15,PB_14,PB_13,PB_12};
+
+void LED_allOFF(){
+ int i;
+ for(i=0;i<4;i++){
+ leds[i]=1;
+ }
+}
+
+void getInputState(double stick_val[],uint8_t SW_val[]){
+ int i;
+ SW_val[0]=onSW;
+ SW_val[1]=otherSW;
+ for(i=0;i<4;i++){
+ stick_val[i]=Stick[i];
+ }
+}
+
+void convertTXdata(double stick_val[],uint8_t SW_val[],char TXdata[]){
+ int i;
+ for(i=0;i<4;i++){
+ TXdata[i]=255*stick_val[i];
+ }
+ TXdata[4]=SW_val[0];
+ TXdata[5]=SW_val[1];
+}
+
+
+int main() {
+ onSW.mode(PullUp);
+ otherSW.mode(PullUp);
+ LED_allOFF();
+ double stick_val[4];
+ uint8_t SW_val[2];
+ char TXdata[128];
+ //set reciever module address (the last three numbers of S/N)
+ const uint8_t address=198;
+ uint8_t FEPstate;
+ while(1) {
+ getInputState(stick_val,SW_val);
+ convertTXdata(stick_val,SW_val,TXdata);
+ FEPstate=fep.TXT_transmit(TXdata,address);
+ leds[3]!=leds[3];
+ if(FEPstate==FEP_P0){
+ leds[0]=0;
+ leds[1]=1;
+ leds[2]=1;
+ continue;
+ }else if(FEPstate==FEP_N0){
+ leds[0]=1;
+ leds[1]=0;
+ leds[2]=1;
+ continue;
+ }else if(FEPstate==FEP_N1){
+ leds[0]=1;
+ leds[1]=1;
+ leds[2]=0;
+ continue;
+ }else{
+ leds[0]=1;
+ leds[1]=1;
+ leds[2]=1;
+ wait(0.1);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Feb 28 14:10:01 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/ad3be0349dc5 \ No newline at end of file