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.
Fork of EndeligKildekode by
robot.cpp
00001 /* 00002 ============================================================================ 00003 Name : robot.cpp 00004 Author : Team 5 00005 Version : 0.1 00006 Date : 13-10-2016 00007 Copyright : Open for all 00008 Description : Program to serve the platform for Pro1 2016 00009 ============================================================================ 00010 */ 00011 #include "odometry.h" 00012 #include "mbed.h" 00013 #include "hack_motor.h" 00014 #include <math.h> 00015 00016 void startfunction( ); 00017 Ticker T1; // create an object T1 of Ticker 00018 00019 int main() 00020 { 00021 startfunction(); 00022 distance = 2000; 00023 get_to_goal();; 00024 robot.stop(); 00025 distance = 4500; 00026 wait_ms(1000); 00027 00028 init(); 00029 while(tickR <= 16) 00030 { 00031 robot.FW(0.5, 0); 00032 wait_ms(10); 00033 } 00034 robot.stop(); 00035 00036 while(1) 00037 { 00038 init(); 00039 startfunction(); 00040 get_to_goal(); 00041 robot.stop(); 00042 wait_ms(1000); 00043 00044 init(); 00045 while(tickR <= 16) 00046 { 00047 robot.FW(0.5, 0); 00048 wait_ms(10); 00049 } 00050 robot.stop(); 00051 } 00052 } 00053 void startfunction() 00054 { 00055 tacho_left.rise(&tickLeft); // attach the address of the count function 00056 //to the falling edge 00057 tacho_right.rise(&tickRight); // attach the address of the count function 00058 //to the falling edge 00059 init(); // initialise parameters (just for you to remember if you need to) 00060 wait_ms(2000); //wait 1 secs here before you go 00061 t.start(); // start timer (just demo of how you can use a timer) 00062 }
Generated on Sat Jul 23 2022 10:05:59 by
1.7.2
