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 lib_workshop_2019
Revision 2:8153195b1672, committed 2019-10-23
- Comitter:
- gvaquette
- Date:
- Wed Oct 23 13:56:30 2019 +0000
- Parent:
- 1:7a8764e627b5
- Child:
- 3:a0e37b8918ac
- Commit message:
- cny testing analog input
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/includes/test_cny.h Wed Oct 23 13:56:30 2019 +0000 @@ -0,0 +1,19 @@ +/** + * @author geoffrey Vaquette + * + * @section DESCRIPTION + * + * Testing value from ultrasonic sensors on robot + * + */ + +#ifndef TEST_CNY_H +#define TEST_CNY_H + +#include "mbed.h" +#include "CNY70.h" + +void ft_print_cny_analog_voltage(AnalogIn &analog_input, Serial &pc); +//void ft_print_cny_library_voltage(CNY70 &cny_sensor, Serial &pc); + +#endif \ No newline at end of file
--- a/main.cpp Wed Oct 23 13:01:35 2019 +0000
+++ b/main.cpp Wed Oct 23 13:56:30 2019 +0000
@@ -3,6 +3,7 @@
#include "console_output.h"
#include "test_us.h"
#include "test_compass.h"
+#include "test_cny.h"
#include "pin_connexions.h"
@@ -36,6 +37,22 @@
pc.printf("\n");
user_choice = ft_get_user_choice(pc);
break;
+
+ case CNY70 :
+ do
+ {
+ pc.printf("\r CNY_1");
+ ft_print_cny_analog_voltage(CNY1, pc);
+ pc.printf("\t CNY_2");
+ ft_print_cny_analog_voltage(CNY2, pc);
+ pc.printf("\t CNY_3");
+ ft_print_cny_analog_voltage(CNY3, pc);
+ } while (!pc.readable());
+ pc.printf("\n");
+ user_choice = ft_get_user_choice(pc);
+ break;
+
+
default :
ft_print_test_menu(pc);
user_choice = ft_get_user_choice(pc);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test_cny/ft_print_value_cny.cpp Wed Oct 23 13:56:30 2019 +0000
@@ -0,0 +1,29 @@
+/**
+ * @author geoffrey Vaquette
+ *
+ * @section DESCRIPTION
+ *
+ * Testing value from ultrasonic sensors on robot
+ *
+ */
+
+#include "mbed.h"
+#include "CNY70.h"
+
+
+void ft_print_cny_analog_voltage(AnalogIn &analog_input, Serial &pc)
+{
+ /* TO BE IMPLEMENTED */
+ const double max_voltage = 3.3;
+ double value = analog_input.read();
+ double voltage = value * max_voltage;
+ pc.printf("voltage value : %lf V ", voltage);
+ return;
+}
+
+
+void ft_print_cny_library_voltage(CNY70 &cny_sensor, Serial &pc)
+{
+ /* TO BE COMPUTED */
+ return;
+}
\ No newline at end of file