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: HOSOKIkikou FEP_RX22 QEI R1370 ikarashiMDC_2byte_ver mbed 2022_NHK_B_canTR PID SEKIkikou
main.cpp
- Committer:
- ikarashikota
- Date:
- 2022-09-29
- Revision:
- 0:877aeb04390a
- Child:
- 2:ea17f9e04972
File content as of revision 0:877aeb04390a:
#include "mbed.h"
#include "controller.h"
#include "pinconfig.h"
#include "ikarashiMDC.h"
Bcon mycon(fepTX, fepRX, fepad);
Serial pc(pcTX, pcRX, 115200);
Serial serial(motorTX, motorRX, 115200);
DigitalOut stop(stop_pin);
DigitalOut led(LED2);
ikarashiMDC motor[] = {
ikarashiMDC(0,0,SM,&serial),
ikarashiMDC(0,1,SM,&serial),
ikarashiMDC(0,2,SM,&serial),
ikarashiMDC(0,3,SM,&serial)
};
uint8_t b[8];
int16_t stick[4];
void recieveController(){
for (int i=0; i<8; i++) b[i] = mycon.getButton(i);
for (int i=0; i<4; i++) stick[i] = mycon.getStick(i);
for (int i=0; i<8; i++) pc.printf("%d ", b[i]);
pc.printf(" | ");
for (int i=0; i<4; i++) pc.printf("%3d ", stick[i]);
pc.printf(" | ");
if (mycon.status) pc.printf("received\r\n");
else pc.printf("anything error...\r\n");
}
int main()
{
mycon.StartReceive();
stop = 1;
led = 1;
while(1) {
//recieveController();
}
}