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 OmniWheels by
Main.cpp
00001 /* 00002 * Main.cpp 00003 * Copyright (c) 2017, ZHAW 00004 * All rights reserved. 00005 * 00006 * Created on: 06.10.2017 00007 * Author: Marcel Honegger 00008 */ 00009 #include "SerialCom.h" 00010 #include <cstdlib> 00011 #include <mbed.h> 00012 00013 00014 00015 00016 00017 using namespace std; 00018 00019 class Main { 00020 00021 public: 00022 00023 Main(); 00024 virtual ~Main(); 00025 00026 private: 00027 00028 static const uint32_t STACK_SIZE = 8192; // stack size of thread, given in [bytes] 00029 00030 Thread thread; 00031 void run(); 00032 }; 00033 00034 Main::Main() : thread(osPriorityNormal, STACK_SIZE) { 00035 00036 thread.start(callback(this, &Main::run)); 00037 } 00038 00039 Main::~Main() {} 00040 00041 void Main::run() { 00042 00043 // create miscellaneous periphery objects 00044 00045 DigitalOut led(LED1); 00046 DigitalIn button(USER_BUTTON); 00047 00048 // create serial server object 00049 00050 00051 00052 RawSerial serial(PA_0, PA_1); 00053 serial.baud(38400); 00054 serial.format(8, SerialBase::None, 1); 00055 00056 DigitalOut reset(PB_12); 00057 DigitalOut modes1(PB_0); 00058 00059 modes1 = 0; 00060 00061 reset = 1; Thread::wait(100); 00062 reset = 0; Thread::wait(100); 00063 reset = 1; Thread::wait(100); 00064 00065 SerialCom serialCom(serial); 00066 00067 // enter main loop 00068 00069 while (true) { 00070 00071 led = !led; 00072 /* 00073 if (//stateMachine.getState() == StateMachine::STATE_MANUAL) { 00074 Thread::wait(100); 00075 } else if (//stateMachine.getState() == StateMachine::STATE_AUTOMATIC) { 00076 Thread::wait(200); 00077 } else { 00078 Thread::wait(500); 00079 } 00080 */ 00081 } 00082 } 00083 00084 /** 00085 * This is the main program of the ROME2RevG firmware. 00086 */ 00087 int32_t main() { 00088 00089 /* Serial pc(USBTX, USBRX); // tx, rx 00090 pc.baud(9600); 00091 pc.printf("was here\r\n");*/ 00092 00093 Main main; 00094 00095 Thread::wait(osWaitForever); 00096 }
Generated on Fri Jul 22 2022 04:53:56 by
