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:
- 2:d0fbced95564
- Parent:
- 1:a6f92e40a3f9
- Child:
- 3:3bcd9a1457fa
diff -r a6f92e40a3f9 -r d0fbced95564 main.cpp
--- a/main.cpp Wed Apr 07 14:25:36 2021 +0000
+++ b/main.cpp Wed Apr 07 15:24:34 2021 +0000
@@ -29,21 +29,24 @@
//printf(“\e[1;1H\e[2J”);
pc.printf("\t Hello World!!! - Здравствуйте Мир!!! - 大家好!!!\n\r");
-
-pc.printf("\n\r %s \t %s \t %s\n\r","Eixo X", "Eixo Y", "Tecla SW");
+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!!!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%s\t\t\t%s\t\t\t%s\n\r","Eixo X", "Eixo Y", "Tecla SW");
while(1) {
// pc.printf("Eixo X = %f \n", VRX.read_u16());
-// x=VRX.read()*255; //Converte uma leitura do ADC em float para formato int e armazena na variável y.
// 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;
- pc.printf("VRX = %f \t", xv);
- pc.printf("VRY = %f \t", yv);
+ 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
+
+ pc.printf("VRX = %1.3fV (%03dh)\t", xv, x);
+ pc.printf("VRY = %1.3fV (%03dh)\t", yv, y);
if (SW == 0) { // Botão usuário pressionado
i++; }