Prototype

Dependencies:   mbed ButtonEventDemo

New.cpp

Committer:
Kelrath1984
Date:
2019-12-02
Revision:
11:052b2fb7d5c7

File content as of revision 11:052b2fb7d5c7:

#include "mbed.h"

#define STICKDOWN p12
#define STICKUP p15
#define PUSH p14
#define LEFT p13 
#define RIGHT p16
 
BusOut Led(LED4,LED3,LED2,LED1);
BusIn Stick(STICKUP, STICKDOWN, LEFT, RIGHT);
 
int main() 
    {
    bool state=0;
    uint8_t mask=0x0F;
    uint8_t value=0x0F;
    
    while(1)
        {
        Led=mask&value;
        
        
        if(Stick==4&&!state)
            { 
                mask=mask<<1;
            }
        
        if(Stick&0xF)
            {
            state=1;
            }
        else
            {
            state=0;
            }
        }
}