Robot_tennis / Mbed 2 deprecated test_jumper

Dependencies:   mbed

main.cpp

Committer:
remiwan
Date:
2022-06-09
Revision:
0:cc4683d537a7

File content as of revision 0:cc4683d537a7:

#include <mbed.h>

//Jumper
DigitalIn jumper(PA_2, PullDown);

//Moteur balle
DigitalOut INAB(PC_3);
DigitalOut INBB(PH_1);
PwmOut PWMB(PB_0);

bool start = false;

void init_moteur_balle(void);

int main()
{
    init_moteur_balle();
    
    while(1)
    {
        if(jumper==1)
        {
            INAB = 0;
            INBB = 1;
            PWMB.write(0.2); 
        }
        else 
        {
            INAB = 0;
            INBB = 1;
            PWMB.write(0); 
        }
    }
    
}


void init_moteur_balle(void)
{
   INAB = 0;
   INBB = 0;
   PWMB.period(0.00005);   // 20 kHz (valid 0 - 20 kHz)
   PWMB.write(0);  
}