Robsonema - Nucleo Master FM

Dependencies:   mbed ros_lib_melodic

Committer:
jazulienux
Date:
Mon Oct 26 22:25:16 2020 +0000
Revision:
0:a4a02499a5f3
Robsonema - NucleoFM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jazulienux 0:a4a02499a5f3 1 #ifndef KICKER_CPP
jazulienux 0:a4a02499a5f3 2 #define KICKER_CPP
jazulienux 0:a4a02499a5f3 3 #include "Kicker.h"
jazulienux 0:a4a02499a5f3 4 #include <mbed.h>
jazulienux 0:a4a02499a5f3 5 #include "config.h"
jazulienux 0:a4a02499a5f3 6
jazulienux 0:a4a02499a5f3 7 DigitalOut * selenoid;
jazulienux 0:a4a02499a5f3 8 DigitalOut * charge;
jazulienux 0:a4a02499a5f3 9
jazulienux 0:a4a02499a5f3 10 Kicker::Kicker()
jazulienux 0:a4a02499a5f3 11 {
jazulienux 0:a4a02499a5f3 12 selenoid = new DigitalOut(PORT_SELENOID);
jazulienux 0:a4a02499a5f3 13 charge = new DigitalOut(PORT_CHARGE);
jazulienux 0:a4a02499a5f3 14 selenoid->write(0);
jazulienux 0:a4a02499a5f3 15 charge->write(1);
jazulienux 0:a4a02499a5f3 16 }
jazulienux 0:a4a02499a5f3 17
jazulienux 0:a4a02499a5f3 18 void Kicker::kicker(float kick_speed)
jazulienux 0:a4a02499a5f3 19 {
jazulienux 0:a4a02499a5f3 20 if(kick_speed != 0) {
jazulienux 0:a4a02499a5f3 21 charge->write(0);
jazulienux 0:a4a02499a5f3 22 wait_ms(200);
jazulienux 0:a4a02499a5f3 23 selenoid->write(1);
jazulienux 0:a4a02499a5f3 24 wait_ms(kick_speed);
jazulienux 0:a4a02499a5f3 25 selenoid->write(0);
jazulienux 0:a4a02499a5f3 26 wait_ms(100);
jazulienux 0:a4a02499a5f3 27 charge->write(1);
jazulienux 0:a4a02499a5f3 28 }
jazulienux 0:a4a02499a5f3 29 }
jazulienux 0:a4a02499a5f3 30
jazulienux 0:a4a02499a5f3 31 #endif