Embedded Programming¶

below are the details about the microcontroler that i worked on throughout this week and i also used it in the final project:
name: Adafruit Feather Bluefruit Sense TYPE: r Feather nRF52840 sense
This Feather microcontroller comes with Bluetooth Low Energy and native USB support featuring the nRF52840! This Feather is an ‘all-in-one’ Arduino-compatible + Bluetooth Low Energy with built in USB plus battery charging. With native USB it works great with CircuitPython, too.
Features:¶
-ARM Cortex M4F (with HW floating point acceleration) running at 64MHz -1MB flash and 256KB SRAM -Native Open Source USB stack - pre-programmed with UF2 bootloader -Bluetooth Low Energy compatible 2.4GHz radio (Details available in the nRF52840 product specification) -FCC / IC / TELEC certified module -Up to +8dBm output power -21 GPIO, 6 x 12-bit ADC pins, up to 12 PWM outputs (3 PWM modules with 4 outputs each) -Pin #13 red LED for general purpose blinking, Blue LED for general purpose connection status, NeoPixel for colorful -feedback -Power/enable pin -Measures 2.0” x 0.9” x 0.28” (51mm x 23mm x 7.2mm) without headers soldered in -Light as a (large?) feather - 6 grams -4 mounting holes -Reset button -SWD debug pads on bottom of PCB
how i programed the microcontroler¶
i programmed the microcontroler to do Multiple Blinks and here is how:
first i downloaded the arduino softwre

after that i linked the microcontroler to the software the steps are shown in the picture

and then i searched for a code online to blug it and push it to the micro controler as you can see in the text below:
Programming the Board process:
-
First, let’s make sure we have correct the drivers installed. If we are using the Web Editor, we do not need to install anything. If we are using an offline editor, we need to install it manually. This can be done by navigating to Tools > Board > Board Manager.... Here we need to look for the Arduino SAM boards (32-bits ARM Cortex-M3) and install it.
-
Now, we need to install the libraries needed. Simply go to Tools > Manage libraries… and search for Scheduler and install it.
Code
Before we begin, let’s take a look at some of the core functions of the library:
Scheduler.startLoop() - Adds a function to the scheduler that will run concurrently with loop().
yield() - Passes control to other tasks when called. Ideally yield() should be used in functions that will take a while to complete.
1 // Include Scheduler since we want to manage multiple tasks.
2 #include
4 int led1 = 13;
5 int led2 = 12;
6 int led3 = 11;
7
8 void setup() {
9
10 Serial.begin(9600);
11
12 // Setup the 3 pins as OUTPUT
13
14 pinMode(led1, OUTPUT);
15
16 pinMode(led2, OUTPUT);
17
18 pinMode(led3, OUTPUT);
19
20 // Add “loop2” and “loop3” to scheduling.
21
22 // “loop” is always started by default.
23
24 Scheduler.startLoop(loop2);
25
26 Scheduler.startLoop(loop3);
27 }
28
29 // Task no.1: blink LED with 1 second delay.
30 void loop() {
31
32 digitalWrite(led1, HIGH);
33
34 // IMPORTANT:
35
36 // When multiple tasks are running ‘delay’ passes control to
37
38 // other tasks while waiting and guarantees they get executed.
39
40 delay(1000);
41
42 digitalWrite(led1, LOW);
43
44 delay(1000);
45 }
46
47 // Task no.2: blink LED with 0.1 second delay.
48 void loop2() {
49
50 digitalWrite(led2, HIGH);
51
52 delay(100);
53
54 digitalWrite(led2, LOW);
55
56 delay(100);
57 }
58
59 // Task no.3: accept commands from Serial port
60 // ‘0’ turns off LED
61 // ‘1’ turns on LED
62 void loop3() {
63
64 if (Serial.available()) {
65
66 char c = Serial.read();
67
68 if (c==‘0’) {
69
70 digitalWrite(led3, LOW);
71
72 Serial.println(“Led turned off!”);
73
74 }
75
76 if (c==‘1’) {
77
78 digitalWrite(led3, HIGH);
79
80 Serial.println(“Led turned on!”);
81
82 }
83
84 }
85
86 // IMPORTANT:
87
88 // We must call ‘yield’ at a regular basis to pass
89
90 // control to other tasks.
91
92 yield();
93