9 years, 8 months ago.

Switches on board do not work on mbed?

Hello!

I've been trying to configure my K64 to simply use a switch make an LED flash, however the switch itself seems unresponsive. Here is the code I've been using:

code

#include "mbed.h"
 
//Delay declared in seconds
 
/*GPIO declaration*/
DigitalOut red(LED_RED);        
DigitalIn sw2(PTC6);
 
 
int main()
{
    /*LED OFF*/
    red=1;
   
    while(1)
    {
        if(sw2==0)
        {
            red = 0;
            wait(.2);
            red = 1;
            wait(1); 
        }
    }
}

Anyone else having a similar problem or know where I'm going wrong?

Question relating to:

The Freedom-K64F is an ultra-low-cost development platform for Kinetis K64, K63, and K24 MCUs.

So for some reason, it all suddenly started working again! Huzzah!

posted by Ben Trevett 24 Jul 2014
Be the first to answer this question.