microbit 2
main.cpp
- Committer:
- bvnoake
- Date:
- 2019-03-03
- Revision:
- 0:efa5691654d7
File content as of revision 0:efa5691654d7:
#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(); }