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.
main.cpp
00001 #include "mbed.h" 00002 #include "buzzer.h" 00003 00004 DigitalOut Fase_A(D4); 00005 DigitalOut Fase_B(D5); 00006 DigitalOut Fase_C(D6); 00007 DigitalOut Fase_D(D7); 00008 Beep Buzzer(D11); 00009 DigitalIn button(USER_BUTTON); 00010 00011 int main() 00012 { 00013 float tempo = 0.05; 00014 int i = 0; 00015 float time = 1.00; 00016 float nota_do = 264.00; 00017 int numero_fases = 4; 00018 int datasheet_numero_passos = 200; 00019 int numero_revolucoes = 2; 00020 int revolucao = datasheet_numero_passos/numero_fases; 00021 Fase_A = 0; 00022 Fase_B = 0; 00023 Fase_C = 0; 00024 Fase_D = 0; 00025 while(1) { 00026 if(button == 0) { 00027 while(i < numero_revolucoes * revolucao) { 00028 Fase_A = 1; 00029 wait(tempo); 00030 Fase_A=0; 00031 Fase_B=1; 00032 wait(tempo); 00033 Fase_B=0; 00034 Fase_C=1; 00035 wait(tempo); 00036 Fase_C=0; 00037 Fase_D=1; 00038 wait(tempo); 00039 Fase_D=0; 00040 i++; 00041 } 00042 i = 0; 00043 Buzzer.beep(nota_do, time); 00044 } 00045 } 00046 }
Generated on Sun Aug 21 2022 13:10:28 by
1.7.2