Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Embed: (wiki syntax)

« Back to documentation index

DigitalIn Class Reference

DigitalIn Class Reference
[Drivers]

A digital input, used for reading the state of a pin. More...

#include <DigitalIn.h>

Public Member Functions

 DigitalIn (PinName pin)
 Create a DigitalIn connected to the specified pin.
 DigitalIn (PinName pin, PinMode mode)
 Create a DigitalIn connected to the specified pin.
int read ()
 Read the input, represented as 0 or 1 (int)
void mode (PinMode pull)
 Set the input pin mode.
int is_connected ()
 Return the output setting, represented as 0 or 1 (int)
 operator int ()
 An operator shorthand for read()

Detailed Description

A digital input, used for reading the state of a pin.

Synchronization level: Interrupt safe

Example:

 // Flash an LED while a DigitalIn is true

 #include "mbed.h"

 DigitalIn enable(p5);
 DigitalOut led(LED1);

 int main() {
     while(1) {
         if(enable) {
             led = !led;
         }
         wait(0.25);
     }
 }

Definition at line 51 of file DigitalIn.h.


Constructor & Destructor Documentation

DigitalIn ( PinName  pin )

Create a DigitalIn connected to the specified pin.

Parameters:
pinDigitalIn pin to connect to

Definition at line 58 of file DigitalIn.h.