Programme d'utilisation servomotors MX12 V1

Committer:
R66Y
Date:
Fri May 19 14:32:14 2017 +0000
Revision:
0:80df663dd15e
programme pour utiliser les servomoteurs MX12.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
R66Y 0:80df663dd15e 1 /* Title: wait
R66Y 0:80df663dd15e 2 * Generic wait functions.
R66Y 0:80df663dd15e 3 *
R66Y 0:80df663dd15e 4 * These provide simple NOP type wait capabilities.
R66Y 0:80df663dd15e 5 *
R66Y 0:80df663dd15e 6 * Example:
R66Y 0:80df663dd15e 7 * > #include "mbed.h"
R66Y 0:80df663dd15e 8 * >
R66Y 0:80df663dd15e 9 * > DigitalOut heartbeat(LED1);
R66Y 0:80df663dd15e 10 * >
R66Y 0:80df663dd15e 11 * > int main() {
R66Y 0:80df663dd15e 12 * > while (1) {
R66Y 0:80df663dd15e 13 * > heartbeat = 1;
R66Y 0:80df663dd15e 14 * > wait(0.5);
R66Y 0:80df663dd15e 15 * > heartbeat = 0;
R66Y 0:80df663dd15e 16 * > wait(0.5);
R66Y 0:80df663dd15e 17 * > }
R66Y 0:80df663dd15e 18 * > }
R66Y 0:80df663dd15e 19 */
R66Y 0:80df663dd15e 20
R66Y 0:80df663dd15e 21 /* mbed Microcontroller Library - wait_api
R66Y 0:80df663dd15e 22 * Copyright (c) 2009 ARM Limited. All rights reserved.
R66Y 0:80df663dd15e 23 */
R66Y 0:80df663dd15e 24
R66Y 0:80df663dd15e 25 #ifndef MBED_WAIT_API_H
R66Y 0:80df663dd15e 26 #define MBED_WAIT_API_H
R66Y 0:80df663dd15e 27
R66Y 0:80df663dd15e 28 #ifdef __cplusplus
R66Y 0:80df663dd15e 29 extern "C" {
R66Y 0:80df663dd15e 30 #endif
R66Y 0:80df663dd15e 31
R66Y 0:80df663dd15e 32 /* Function: wait
R66Y 0:80df663dd15e 33 * Waits for a number of seconds, with microsecond resolution (within
R66Y 0:80df663dd15e 34 * the accuracy of single precision floating point).
R66Y 0:80df663dd15e 35 *
R66Y 0:80df663dd15e 36 * Variables:
R66Y 0:80df663dd15e 37 * s - number of seconds to wait
R66Y 0:80df663dd15e 38 */
R66Y 0:80df663dd15e 39 void wait(float s);
R66Y 0:80df663dd15e 40
R66Y 0:80df663dd15e 41 /* Function: wait_ms
R66Y 0:80df663dd15e 42 * Waits a number of milliseconds.
R66Y 0:80df663dd15e 43 *
R66Y 0:80df663dd15e 44 * Variables:
R66Y 0:80df663dd15e 45 * ms - the whole number of milliseconds to wait
R66Y 0:80df663dd15e 46 */
R66Y 0:80df663dd15e 47 void wait_ms(int ms);
R66Y 0:80df663dd15e 48
R66Y 0:80df663dd15e 49 /* Function: wait_us
R66Y 0:80df663dd15e 50 * Waits a number of microseconds.
R66Y 0:80df663dd15e 51 *
R66Y 0:80df663dd15e 52 * Variables:
R66Y 0:80df663dd15e 53 * us - the whole number of microseconds to wait
R66Y 0:80df663dd15e 54 */
R66Y 0:80df663dd15e 55 void wait_us(int us);
R66Y 0:80df663dd15e 56
R66Y 0:80df663dd15e 57 #ifdef TARGET_LPC11U24
R66Y 0:80df663dd15e 58 /* Function: sleep
R66Y 0:80df663dd15e 59 * Send the microcontroller to sleep
R66Y 0:80df663dd15e 60 *
R66Y 0:80df663dd15e 61 * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
R66Y 0:80df663dd15e 62 * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
R66Y 0:80df663dd15e 63 * dynamic power used by the processor, memory systems and buses. The processor, peripheral and
R66Y 0:80df663dd15e 64 * memory state are maintained, and the peripherals continue to work and can generate interrupts.
R66Y 0:80df663dd15e 65 *
R66Y 0:80df663dd15e 66 * The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
R66Y 0:80df663dd15e 67 *
R66Y 0:80df663dd15e 68 * Note: The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
R66Y 0:80df663dd15e 69 * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
R66Y 0:80df663dd15e 70 * able to access the LocalFileSystem
R66Y 0:80df663dd15e 71 */
R66Y 0:80df663dd15e 72 void sleep(void);
R66Y 0:80df663dd15e 73
R66Y 0:80df663dd15e 74 /* Function: deepsleep
R66Y 0:80df663dd15e 75 * Send the microcontroller to deep sleep
R66Y 0:80df663dd15e 76 *
R66Y 0:80df663dd15e 77 * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
R66Y 0:80df663dd15e 78 * has the same sleep features as sleep plus it powers down peripherals and clocks. All state
R66Y 0:80df663dd15e 79 * is still maintained.
R66Y 0:80df663dd15e 80 *
R66Y 0:80df663dd15e 81 * The processor can only be woken up by an external interrupt on a pin or a watchdog timer.
R66Y 0:80df663dd15e 82 *
R66Y 0:80df663dd15e 83 * Note: The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
R66Y 0:80df663dd15e 84 * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
R66Y 0:80df663dd15e 85 * able to access the LocalFileSystem
R66Y 0:80df663dd15e 86 */
R66Y 0:80df663dd15e 87 void deepsleep(void);
R66Y 0:80df663dd15e 88 #endif
R66Y 0:80df663dd15e 89
R66Y 0:80df663dd15e 90 #ifdef __cplusplus
R66Y 0:80df663dd15e 91 }
R66Y 0:80df663dd15e 92 #endif
R66Y 0:80df663dd15e 93
R66Y 0:80df663dd15e 94 #endif