A program designed to run on the microbit. Used for driving a buggy.
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 /* 00002 The MIT License (MIT) 00003 00004 Copyright (c) 2016 British Broadcasting Corporation. 00005 This software is provided by Lancaster University by arrangement with the BBC. 00006 00007 Permission is hereby granted, free of charge, to any person obtaining a 00008 copy of this software and associated documentation files (the "Software"), 00009 to deal in the Software without restriction, including without limitation 00010 the rights to use, copy, modify, merge, publish, distribute, sublicense, 00011 and/or sell copies of the Software, and to permit persons to whom the 00012 Software is furnished to do so, subject to the following conditions: 00013 00014 The above copyright notice and this permission notice shall be included in 00015 all copies or substantial portions of the Software. 00016 00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00020 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00021 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00022 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00023 DEALINGS IN THE SOFTWARE. 00024 */ 00025 00026 #include "buggy_function.h" 00027 #include "Microbit_function.h" 00028 00029 /* available Commands from buggy_function 00030 * forward 00031 * left 00032 * right 00033 * hold 00034 * stop 00035 * bear_Right 00036 * bear_Left 00037 * readButton 00038 * rolldice 00039 * follow_Line 00040 */ 00041 00042 /* available commands from Microbit_function 00043 * Compass 00044 * pointNorth 00045 * pointSouth 00046 * Display 00047 */ 00048 int main() 00049 { 00050 microBit_Setup(); 00051 stop(); 00052 hold(3); 00053 forward(1000); 00054 follow_Line(10); 00055 pointNorth(); 00056 hold(3); 00057 pointSouth(); 00058 while(1) 00059 { 00060 Compass(); 00061 } 00062 } 00063
Generated on Fri Jul 15 2022 13:57:07 by 1.7.2