![](/media/cache/profiles/f0fcf351df4eb6786e9bb6fc4e2dee02.jpg.50x50_q85.jpg)
DRV8830/TI Motor Driver sample program.\\ This program can control two motors.
main.cpp
- Committer:
- kenjiArai
- Date:
- 2014-07-12
- Revision:
- 3:db817fb05ba7
- Parent:
- 2:e0b9fd6126d1
- Child:
- 4:58734155cd29
File content as of revision 3:db817fb05ba7:
/* * mbed Application program for the mbed ST NUCLEO F401RE Board * * Copyright (c) 2014 Kenji Arai / JH1PJL * http://www.page.sannet.ne.jp/kenjia/index.html * http://mbed.org/users/kenjiArai/ * Created: July 12th, 2014 * Revised: July 12th, 2014 * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ // Include --------------------------------------------------------------------------------------- #include "mbed.h" #include "rtos.h" // Object ---------------------------------------------------------------------------------------- DigitalOut myled(LED1); DigitalIn usr_sw(PC_13); // Function prototypes --------------------------------------------------------------------------- extern int mon( void); //------------------------------------------------------------------------------------------------- // Control Program //------------------------------------------------------------------------------------------------- int read_sw (void){ if (usr_sw == 0){ return 1; } else { return 0;} } // Monitor program void mon_thread(void const *args){ while (true){ mon(); } } // Thread definition osThreadDef(mon_thread, osPriorityNormal, 2048); int main() { // Starts 1st thread osThreadCreate(osThread(mon_thread), NULL); while(1) { myled = !myled; Thread::wait(1000); } }