Tutorial for first mbed project

Dependencies:   mbed lib_workshop_2019

Files at this revision

API Documentation at this revision

Comitter:
gvaquette
Date:
Wed Oct 23 12:16:18 2019 +0000
Child:
1:7a8764e627b5
Commit message:
console_ouput

Changed in this revision

includes/console_output.h Show annotated file Show diff for this revision Revisions of this file
includes/pin_connexions.h Show annotated file Show diff for this revision Revisions of this file
lib_workshop_2019.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
src/console_output.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/includes/console_output.h	Wed Oct 23 12:16:18 2019 +0000
@@ -0,0 +1,25 @@
+#ifndef CONSOLEOUTPUT_H
+#define CONSOLEOUTPUT_H
+
+/**
+ * Include : Mbed Library
+ */
+#include "mbed.h"
+
+enum e_test {
+    WELCOME = 0,
+    ULTRASONIC = 1,
+    COMPASS = 2,
+    CNY70 = 3,
+    VBAT = 4,
+    LEFT_MOTOR = 5,
+    RIGHT_MOTOR = 6,
+    PIXY = 7
+};
+
+
+void ft_print_test_menu(Serial &pc);
+
+
+
+#endif /* CONSOLEOUTPUT_H */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/includes/pin_connexions.h	Wed Oct 23 12:16:18 2019 +0000
@@ -0,0 +1,44 @@
+#define BOUSSOLE_adress     0xC0
+#define PIXY_adress         0x54
+
+#define CC_BLOCSIZE         14
+#define N_BLOCSIZE          12
+
+#define N_BLOCCODE          0xAA55
+#define CC_BLOCCODE         0xAA56
+
+
+typedef unsigned char   Byte;
+typedef unsigned short  Word;
+typedef unsigned long   lWord;
+
+Serial      Pc      (PA_2, PA_3, 115200);
+
+/****************************************/
+/**         CNY declarations           **/
+/*          To be completed             */ 
+
+AnalogIn    CNY1    (PA_7);
+AnalogIn    CNY2    (PC_2);
+AnalogIn    CNY3    (PC_3);
+
+/**     End of CNY declaration         **/
+/****************************************/
+
+
+/****************************************/
+/**     Motor by PWM declarations       **/
+/*          To be completed             */ 
+
+DigitalOut  DIR_1G    (PC_9);
+DigitalOut  DIR_2G    (PC_8);
+DigitalOut  DIR_1D    (PC_6);
+DigitalOut  DIR_2D    (PC_5);
+
+PwmOut      Pwm_MG  (PA_9);
+PwmOut      Pwm_MD  (PA_8);
+
+/**  End of Motor by PWM declarations  **/
+/****************************************/
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib_workshop_2019.lib	Wed Oct 23 12:16:18 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/gvaquette/code/lib_workshop_2019/#fc4b77fce4ab
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 23 12:16:18 2019 +0000
@@ -0,0 +1,8 @@
+#include "mbed.h"
+#include "console_output.h"
+
+Serial      pc      (PA_2, PA_3, 115200);
+
+int main() {
+    ft_print_test_menu(pc);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 23 12:16:18 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/console_output.cpp	Wed Oct 23 12:16:18 2019 +0000
@@ -0,0 +1,14 @@
+#include "mbed.h"
+#include "console_output.h"
+
+void ft_print_test_menu(Serial &Pc)
+{
+    Pc.printf ("\n\n\n\n\rTesting program \n\n\r Which test do you want to perform ?\n\n");
+    Pc.printf ("\r%d- Ultrasonic sensors (all of them)\n", ULTRASONIC);
+    Pc.printf ("\r%d- Compass and I2C\n", COMPASS);
+    Pc.printf ("\r%d- CNY70 (all of them) \n",CNY70);
+    Pc.printf ("\r%d- VBAT \t! Wrong voltage !\n",VBAT);
+    Pc.printf ("\r%d- Left motor\n", LEFT_MOTOR);
+    Pc.printf ("\r%d- MRight motor \n", RIGHT_MOTOR);
+    Pc.printf ("\r%d- PIXY (CMUCAM5)\n", PIXY);
+}
\ No newline at end of file