microbit 2
Diff: main.cpp
- Revision:
- 0:efa5691654d7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Mar 03 09:19:54 2019 +0000 @@ -0,0 +1,68 @@ +#include "MicroBit.h" +//#include "binTree.h" + +MicroBit uBit; + +uint64_t reading; +bool running = false; +int value = 0; +bool BP = false; + +int read1; + + +int main() +{ + + uBit.init(); + while(1) + { + MicroBitPin P0(MICROBIT_ID_IO_P0, MICROBIT_PIN_P0, PIN_CAPABILITY_DIGITAL); + + value = P0.getDigitalValue(); + + reading = system_timer_current_time(); + read1 = uBit.systemTime(); + while(P0.getDigitalValue() == 1) + { + BP = true; + } + read1 = uBit.systemTime() - read1; + while (value == 1) + { + // uBit.display.scroll("read"); + // read = system_timer_current_time() - reading; + if (1 > 0 && 1 < 500) + { + //shows a dot on the screen + uBit.display.scroll("dot"); + } + //if button is held down for a brief amount of time + else if (1 > 500 ) + { + //shows a dash on screen + uBit.display.scroll("dash"); + } + //if button held down for a longer time + /*else if (timepressed > 1500) + { + //displays stop along the screen + uBit.display.scroll("STOP"); + //sets mcode as false so buttons stop running + mcode = false; + } + */ + value = 0; + } + + + + + + } + release_fiber(); + + +} + + \ No newline at end of file