SerialArduino

Dependencies:   SerialArduino

main.cpp

Committer:
THtakahiro702286
Date:
2022-06-09
Revision:
1:f64517e88878
Parent:
0:816cb0f3dcd4

File content as of revision 1:f64517e88878:

#include "mbed.h"
#include "SerialArduino.h"

SerialArduino mini(PC_10,PC_11,115200);
BufferedSerial pc(USBTX,USBRX,115200);

int main()
{
    uint8_t h1,h2,i;
    bool b[12]={0};
    uint8_t t[2],s[4];
    char CRLF[3] = "\r\n";
    while(1)
    {
        h1 = mini.getHedder1();
        h2 = mini.getHedder2();
        for(i=0;i<12;i++)
        {
            b[i] = mini.getButton(i);
            printf("%d ",b[i]);
        }
        printf("|");
        for(i=0;i<2;i++)
        {
            t[i] = mini.getTrigger(i);
            printf("%3d ",t[i]);
        }
        printf("|");
        for(i=0;i<4;i++)
        {
            s[i] = mini.getStick(i);
            printf("%3d ",s[i]);
        }
//        printf("%d",mini.getRawButton());
        
        if(mini.getState()) printf("ok");
        else printf("bad");
        printf("\r\n");
        thread_sleep_for(10);
        
    }
}