FEP TX program TokiPS4
Dependencies: FEP_TX22 SerialArduino mbed
Revision 2:81cf98f7f721, committed 2022-10-08
- Comitter:
- watarushimoda
- Date:
- Sat Oct 08 04:08:26 2022 +0000
- Parent:
- 1:2e8270b1bc1b
- Commit message:
- FEP TX program TokiPS4
Changed in this revision
--- a/FEP_TX22.lib Wed Oct 05 06:49:02 2022 +0000 +++ b/FEP_TX22.lib Sat Oct 08 04:08:26 2022 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/NHK-Robocon2016_Nagaoka_B_Team/code/FEP_TX22/#729795414ebd +https://os.mbed.com/teams/NHK-Robocon2016_Nagaoka_B_Team/code/FEP_TX22/#303170592014
--- a/main.cpp Wed Oct 05 06:49:02 2022 +0000
+++ b/main.cpp Sat Oct 08 04:08:26 2022 +0000
@@ -1,24 +1,42 @@
+//PS4コントローラーにしわき拡張版
#include "FEP_TX22.h"
#include "SerialArduino.h"
#include "pinconfig.h"
#define SWNUM 8
+#define DATANUM 128
SerialArduino mini(TXino, RXino, 115200);
//FEP,PCの宣言
-FEP_TX22 FEP_TX22(fepTX, fepRX, 5);
+FEP_TX22 FEP_TX22(fepTX, fepRX, fepad);
Serial pc(USBTX, USBRX, 115200);
+//拡張部の宣言
+AnalogIn volume1(vol1);
+AnalogIn volume2(vol2);
+AnalogIn volume3(vol3);
+DigitalIn stop(em_stop);
+DigitalIn toggle1(tgl1);
+DigitalIn toggle2(tgl2);
+DigitalIn toggle3(tgl3);
+
int main()
{
uint8_t data[DATANUM];
while(1)
{
mini.getState(data);
+ data[9] = (int)(volume1*255); //左
+ data[10] = (int)(volume2*255); //中
+ data[11] = (int)(volume3*255); //右
+ data[12] = stop; //上
+ data[13] = toggle1; //左
+ data[14] = toggle2; //中
+ data[15] = toggle3; //右
//PC表示部分
- pc.printf("sw:%3d %3d | stick:%3d %3d %3d %3d | trig:%3d %3d | %3d\r\n"
- , data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]);
+ pc.printf("%3d | sw:%3d %3d | stick:%3d %3d %3d %3d | trig:%3d %3d | vol:%3d %3d %3d | tgl:%3d %3d %3d | %3d\r\n"
+ , data[12], data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[9], data[10], data[11], data[13], data[14], data[15], data[8]);
- FEP_TX22.SendData(data);
+ FEP_TX22.SendData(data, 16);
}
}
\ No newline at end of file
--- a/pinconfig.h Wed Oct 05 06:49:02 2022 +0000 +++ b/pinconfig.h Sat Oct 08 04:08:26 2022 +0000 @@ -16,4 +16,17 @@ static PinName const TXino = PB_6; static PinName const RXino = PB_7; +/*VOLUME*/ +static PinName const vol1 = PA_4; +static PinName const vol2 = PA_1; +static PinName const vol3 = PA_0; + +/*遠隔非常停止*/ +static PinName const em_stop = PB_1; + +/*TOGGLE*/ +static PinName const tgl1 = PA_8; +static PinName const tgl2 = PF_1; +static PinName const tgl3 = PF_0; + #endif \ No newline at end of file