Andy A / Mbed 2 deprecated buttonTest

Dependencies:   USBDevice mbed

Fork of randomSearch by Andy A

main.cpp

Committer:
AndyA
Date:
2016-02-03
Revision:
3:7fe4dd911b58
Parent:
2:15eab46e805b

File content as of revision 3:7fe4dd911b58:

#include "mbed.h"
#include "USBMouseKeyboard.h"

USBMouseKeyboard keyboard;
DigitalIn button(P0_1,PullUp);

void SetCaps(bool on)
{
    bool currentlyOn = ((keyboard.lockStatus() & 0x02) == 0x02);
    if (currentlyOn != on)
    keyboard.keyCode(KEY_CAPS_LOCK);
}

main()
{
    wait(10); // wait, gives windows a chance to set up the mouse/keyboard drivers.
    while (true) {
        SetCaps(button == 0);
    }
}