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.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 4:c35ebfe0669d
- Parent:
- 3:3bcd9a1457fa
--- a/main.cpp Wed Apr 07 18:03:48 2021 +0000
+++ b/main.cpp Wed Apr 07 18:23:13 2021 +0000
@@ -30,7 +30,7 @@
pc.printf("\t Hello World!!! - Здравствуйте Мир!!! - 大家好!!!\n\r");
pc.printf("\n\rWelcome to the world of ADC (A0 and A1) conected to the MH Joystick \n\r- Digital In (PC_13) to Joystick SWitch included\n\r");
-pc.printf("\n\r\t\t\t\t!!!ATENTION!!! \n\r=> Joystick +5V pin MUST be connected to NUCLEO-F103RB 3V3 pin to avoid damaging NUCLEOs ADC!!!\n\r");
+pc.printf("\n\r\t\t\t\t!!!ATTENTION!!! \n\r=> Joystick +5V pin MUST be connected to NUCLEO-F103RB 3V3 pin to avoid damaging NUCLEOs ADC!!!\n\r");
pc.printf("\n\r%s\t\t\t\t%s\t\t\t\t%s\n\r","Eixo X", "Eixo Y", "Tecla SW");
while(1) {
@@ -39,8 +39,8 @@
// pc.printf("VRX = %f \t", VRX.read());
// pc.printf("VRY = %f \t", VRY.read());
- xv = VRX.read()*3.300; //lê valor da entrada analógica de 0,0 a 1,0 = full ADC conversion range e converte para faixa de 0,0 a 3,3V da alimentação
- yv = VRY.read()*3.300;
+ xv = VRX.read()*3.300; //lê valor da entrada analógica de 0,0 a 1,0 = full ADC conversion range
+ yv = VRY.read()*3.300; //e converte para faixa de 0,0 a 3,3V da alimentação
x = VRX.read()*255; //Converte uma leitura do ADC em float para formato int e armazena na variável x
y = VRY.read()*255; //Converte uma leitura do ADC em float para formato int e armazena na variável y
@@ -48,12 +48,15 @@
pc.printf("VRX = %1.3fV (%03dd - 0x%02Xh)\t", xv, x, x);
pc.printf("VRY = %1.3fV (%03dd - 0x%02Xh)\t", yv, y, y);
- if (SW == 0) { // Botão usuário pressionado
+ if (SW == 0) { // Botão usuário pressionado
+ myled = 1;
+ wait(0.1);
+ myled = 0;
i++; }
pc.printf("SW = %d\r",i);
- wait(0.2);
+ wait(0.1);
}
}