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.
Dependencies: MS9g_move_sin mbed-STM32F103C8T6 mbed
main.cpp@0:87eb8c465506, 2018-06-16 (annotated)
- Committer:
- RuslanUrya
- Date:
- Sat Jun 16 00:35:07 2018 +0000
- Revision:
- 0:87eb8c465506
can actuator;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| RuslanUrya | 0:87eb8c465506 | 1 | #include "mbed.h" |
| RuslanUrya | 0:87eb8c465506 | 2 | #include "stm32f103c8t6.h" |
| RuslanUrya | 0:87eb8c465506 | 3 | #include "MS9g_move_sin.h" |
| RuslanUrya | 0:87eb8c465506 | 4 | |
| RuslanUrya | 0:87eb8c465506 | 5 | DigitalOut myled(PC_13); |
| RuslanUrya | 0:87eb8c465506 | 6 | InterruptIn button_left (PA_0); |
| RuslanUrya | 0:87eb8c465506 | 7 | InterruptIn button_right (PA_1); |
| RuslanUrya | 0:87eb8c465506 | 8 | Servo_9g_CAN Servo(PA_11, PA_12); |
| RuslanUrya | 0:87eb8c465506 | 9 | |
| RuslanUrya | 0:87eb8c465506 | 10 | void left() { |
| RuslanUrya | 0:87eb8c465506 | 11 | Servo.sendPosition(4, 1); |
| RuslanUrya | 0:87eb8c465506 | 12 | } |
| RuslanUrya | 0:87eb8c465506 | 13 | void right() { |
| RuslanUrya | 0:87eb8c465506 | 14 | Servo.sendPosition(4, 2); |
| RuslanUrya | 0:87eb8c465506 | 15 | } |
| RuslanUrya | 0:87eb8c465506 | 16 | void neitral() { |
| RuslanUrya | 0:87eb8c465506 | 17 | Servo.sendPosition(4, 1.5); |
| RuslanUrya | 0:87eb8c465506 | 18 | } |
| RuslanUrya | 0:87eb8c465506 | 19 | |
| RuslanUrya | 0:87eb8c465506 | 20 | int main() { |
| RuslanUrya | 0:87eb8c465506 | 21 | confSysClock(); |
| RuslanUrya | 0:87eb8c465506 | 22 | button_left.fall(&left); |
| RuslanUrya | 0:87eb8c465506 | 23 | button_left.rise(&neitral); |
| RuslanUrya | 0:87eb8c465506 | 24 | button_right.fall(&right); |
| RuslanUrya | 0:87eb8c465506 | 25 | button_right.rise(&neitral); |
| RuslanUrya | 0:87eb8c465506 | 26 | while(1) { |
| RuslanUrya | 0:87eb8c465506 | 27 | myled != myled; |
| RuslanUrya | 0:87eb8c465506 | 28 | wait(0.5); |
| RuslanUrya | 0:87eb8c465506 | 29 | } |
| RuslanUrya | 0:87eb8c465506 | 30 | } |