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: mbed
main.cpp@0:247c31683f0b, 2020-11-21 (annotated)
- Committer:
- yuki0701
- Date:
- Sat Nov 21 08:17:05 2020 +0000
- Revision:
- 0:247c31683f0b
a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yuki0701 | 0:247c31683f0b | 1 | #include "mbed.h" |
yuki0701 | 0:247c31683f0b | 2 | |
yuki0701 | 0:247c31683f0b | 3 | PwmOut motor1(p21); |
yuki0701 | 0:247c31683f0b | 4 | PwmOut motor2(p22); |
yuki0701 | 0:247c31683f0b | 5 | PwmOut motor3(p23); |
yuki0701 | 0:247c31683f0b | 6 | PwmOut motor4(p24); |
yuki0701 | 0:247c31683f0b | 7 | DigitalOut led(LED1); |
yuki0701 | 0:247c31683f0b | 8 | |
yuki0701 | 0:247c31683f0b | 9 | int main() |
yuki0701 | 0:247c31683f0b | 10 | { |
yuki0701 | 0:247c31683f0b | 11 | motor1.period_us(10); |
yuki0701 | 0:247c31683f0b | 12 | motor2.period_us(10); |
yuki0701 | 0:247c31683f0b | 13 | motor3.period_us(10); |
yuki0701 | 0:247c31683f0b | 14 | motor4.period_us(10); |
yuki0701 | 0:247c31683f0b | 15 | |
yuki0701 | 0:247c31683f0b | 16 | while(1) { |
yuki0701 | 0:247c31683f0b | 17 | |
yuki0701 | 0:247c31683f0b | 18 | motor1=0.2; |
yuki0701 | 0:247c31683f0b | 19 | motor2=0; |
yuki0701 | 0:247c31683f0b | 20 | motor3=0.2; |
yuki0701 | 0:247c31683f0b | 21 | motor4=0; |
yuki0701 | 0:247c31683f0b | 22 | |
yuki0701 | 0:247c31683f0b | 23 | wait(1); |
yuki0701 | 0:247c31683f0b | 24 | |
yuki0701 | 0:247c31683f0b | 25 | motor1=0; |
yuki0701 | 0:247c31683f0b | 26 | motor2=0; |
yuki0701 | 0:247c31683f0b | 27 | motor3=0; |
yuki0701 | 0:247c31683f0b | 28 | motor4=0; |
yuki0701 | 0:247c31683f0b | 29 | |
yuki0701 | 0:247c31683f0b | 30 | wait(1); |
yuki0701 | 0:247c31683f0b | 31 | |
yuki0701 | 0:247c31683f0b | 32 | motor1=0; |
yuki0701 | 0:247c31683f0b | 33 | motor2=0.2; |
yuki0701 | 0:247c31683f0b | 34 | motor3=0; |
yuki0701 | 0:247c31683f0b | 35 | motor4=0.2; |
yuki0701 | 0:247c31683f0b | 36 | |
yuki0701 | 0:247c31683f0b | 37 | wait(1); |
yuki0701 | 0:247c31683f0b | 38 | |
yuki0701 | 0:247c31683f0b | 39 | motor1=0; |
yuki0701 | 0:247c31683f0b | 40 | motor2=0; |
yuki0701 | 0:247c31683f0b | 41 | motor3=0; |
yuki0701 | 0:247c31683f0b | 42 | motor4=0; |
yuki0701 | 0:247c31683f0b | 43 | |
yuki0701 | 0:247c31683f0b | 44 | wait(1); |
yuki0701 | 0:247c31683f0b | 45 | |
yuki0701 | 0:247c31683f0b | 46 | led = 1; |
yuki0701 | 0:247c31683f0b | 47 | printf("print\n\r"); |
yuki0701 | 0:247c31683f0b | 48 | } |
yuki0701 | 0:247c31683f0b | 49 | |
yuki0701 | 0:247c31683f0b | 50 | /*while(1){ |
yuki0701 | 0:247c31683f0b | 51 | printf("a\n\r"); |
yuki0701 | 0:247c31683f0b | 52 | }*/ |
yuki0701 | 0:247c31683f0b | 53 | |
yuki0701 | 0:247c31683f0b | 54 | |
yuki0701 | 0:247c31683f0b | 55 | } |