Counts to 15 and back to 0 using the 4 LEDs
Dependencies: C12832_lcd LM75B mbed
Fork of app-board-LM75B by
main.cpp
- Committer:
- wren301
- Date:
- 2014-04-29
- Revision:
- 4:18680ed950a8
- Parent:
- 3:4d612f16ad84
File content as of revision 4:18680ed950a8:
#include "mbed.h" DigitalOut blue3(LED1); DigitalOut blue2(LED2); DigitalOut blue1(LED3); DigitalOut blue0(LED4); int main () { int numToDisplay = 0; int highNum = 15; if(highNum > 15) { error("Number too high to count to!"); } while (1) { for (int i = 0; i < 2*highNum; i++) { numToDisplay = i; if (i > highNum) { numToDisplay = 2*highNum - i; } blue3 = (numToDisplay & 8); blue2 = (numToDisplay & 4); blue1 = (numToDisplay & 2); blue0 = (numToDisplay & 1); wait(1.0); } } }