robot S2 pour CE2 avec ROS
Dependencies: mbed rosserial_mbed_lib
Diff: main.cpp
- Revision:
- 0:939d180d8f7f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Oct 09 13:54:19 2019 +0000 @@ -0,0 +1,27 @@ +#include "mbed.h" + +DigitalOut myled(LED1); +DigitalOut av_ar_G(p12); +DigitalOut av_ar_D(p11); +PwmOut pwm_G(p23); +PwmOut pwm_D(p22); +Serial serial(p13,p14); + +void InitMot(){ + av_ar_G=av_ar_D=0; + pwm_G.pulsewidth_us(0); + pwm_G.period_us(100); + pwm_D.pulsewidth_us(0); + pwm_D.period_us(100); +} + +int main() { + InitMot(); + while(1) { + serial.printf("A\n"); + myled = 1; + wait(0.2); + myled = 0; + wait(0.2); + } +}