Lab that has to do with basic IO on mbed.

Dependencies:   DebounceIn mbed PinDetect

JessesLab1/main.cpp

Committer:
Jesse Baker
Date:
2016-01-17
Revision:
40:430e3884226a
Parent:
39:8bd6d99afa67
Child:
41:5bcf3ab83113

File content as of revision 40:430e3884226a:

//* <- remove this if you want to code this and comment Georges
#include "mbed.h"
#include "DebounceIn.h"
#include "PinDetect.h"

PinDetect pb(p8);
PwmOut led(p21);

int main() {

float pwr = 0;

  pb.mode(PullUp);

  while(1) {

    if(pb) {

      pwr = pwr + 0.1;

      if (pwr >= 1) {
        pwr = 0;
      }

      led.write(pwr);
    }
    else {
      led.write(0);
    }

    //led = !pb;

  }
}