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: dagozilla_utils_isaac cmps_dagoz motor_dagoz BaseControlF7 encoder_dagoz EncoderMotorInterrupt ros_lib_melodic_test
Diff: main.cpp
- Revision:
- 0:1c22457d4aed
- Child:
- 1:8b6487805a90
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Jan 17 05:22:45 2019 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+#include "Nucleo_Encoder_16_bits.h"
+
+Nucleo_Encoder_16_bits encoder1(TIM1);
+Nucleo_Encoder_16_bits encoder2(TIM2);
+Nucleo_Encoder_16_bits encoder3(TIM3);
+Nucleo_Encoder_16_bits encoder4(TIM4);
+Nucleo_Encoder_16_bits encoder5(TIM8);
+Nucleo_Encoder_16_bits encoder6(TIM9);
+Nucleo_Encoder_16_bits encoder7(TIM12);
+
+void print_char()
+{
+ int a1 = encoder1.GetCounter(0);
+ int a2 = encoder2.GetCounter(0);
+ int a3 = encoder3.GetCounter(0);
+ int a4 = encoder4.GetCounter(0);
+ int a5 = encoder5.GetCounter(0);
+ int a6 = encoder6.GetCounter(0);
+ int a7 = encoder7.GetCounter(0);
+ printf("%d %d %d %d %d %d %d\n", a1, a2, a3, a4, a5, a6, a7);
+}
+
+Thread thread;
+
+DigitalOut led1(LED1);
+
+void print_thread()
+{
+ while (true) {
+ wait(1);
+ print_char();
+ }
+}
+
+int main()
+{
+ printf("\n\n*** RTOS basic example ***\n");
+
+ thread.start(print_thread);
+
+ while (true) {
+ led1 = !led1;
+ wait(0.5);
+ }
+}