Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of Dragonfly_DigitalOut_BusOut_Example by
main.cpp
- Committer:
- mfiore
- Date:
- 2015-10-01
- Revision:
- 0:2c71706c23d3
- Child:
- 1:dea224e5ad51
File content as of revision 0:2c71706c23d3:
/** Dragonfly DigitalOut and BusOut Example Program
*
* This program demonstrates how to write digital outputs using the
* MultiTech Dragonfly and MultiTech UDK2 hardware. The only
* additional hardware required is LEDs. Connect the LEDs between the
* bus pins and ground.
*
* Pins are active low, so 0V = 0 and 5V/3.3V = 1.
*
* This program blinks the D3 LED using a DigitalOut pin and writes
* to pins D9, D10, and D12 as a 3 pin bus.
*/
#include "mbed.h"
int main() {
// write digital pins D9, D10, and D12 as a 3 pin bus
// the first pin is the LSB of the bus, the last is the MSB
BusOut bus(D9, D10, D12);
// pin D3 is connected to the LED
DigitalOut led(D3);
int count = 0;
while (true) {
printf("writing %d to bus\r\n", count);
bus = count++;
count %= 8;
led = !led;
wait_ms(500);
}
}
