DORA prova Attuatore
DORA_Actuator_Control.cpp
- Committer:
- pinofal
- Date:
- 2022-03-01
- Revision:
- 3:99f8c29cbac7
- Parent:
- 2:553cc8c4474f
File content as of revision 3:99f8c29cbac7:
#include "mbed.h"
// genera un oggetto serial collegato al PC
//Serial pc(USBTX, USBRX);
// output per pilotare attuatore DORA con while(true) e wait_us
DigitalOut OutPWMScafesso(PA_10);
// Output per pilotaggio attuatore DORA con funzioni PWM
//PwmOut OutPWM (PB_3);
DigitalOut OutPWM (PB_3);
DigitalOut Relay(PB_8);
// User Button, LED
DigitalIn myOnBoardButton(USER_BUTTON); // pulsante Blu sulla scheda. Associato a PC_13
DigitalOut myOnBoardLed(LED2); // LED verde sulla scheda. Associato a PA_5
//++++++++++++++++++
// Ciclo principale
//++++++++++++++++++
int main()
{
//pc.baud(921600); //921600 bps
//pc.printf("Welcome to DORA \r\n");
// inizializza il PWM
//OutPWM.period_us(1000); // periodo del PWM
//OutPWM.write(0.5); // inizializza duty cycle del PWM
Relay = 1;
wait(300);
Relay = 0;
while(true)
{
OutPWM=1;
wait_us(500);
OutPWM=0;
wait_us(500);
/*
//myOnBoardLed = 1;
OutPWMScafesso=1;
wait_us(000);
//myOnBoardLed = 0;
OutPWMScafesso = 0;
wait_us(1000);
*/
}
}