Skip to content

Commit a63efac

Browse files
authored
Fix BT code (#1149)
1 parent 7ed5a5f commit a63efac

File tree

1 file changed

+9
-6
lines changed
  • content/hardware/04.pro/boards/portenta-c33/tutorials/user-manual

1 file changed

+9
-6
lines changed

content/hardware/04.pro/boards/portenta-c33/tutorials/user-manual/content.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,19 +1077,22 @@ The Portenta C33 board features an onboard Bluetooth® module, the ESP32-C3-MINI
10771077
To enable Bluetooth® communication on the Portenta C33, you can use the [`ArduinoBLE` library](https://github.com/arduino-libraries/ArduinoBLE)`ArduinoBLE` library. Let's walk through an example code demonstrating some of its Bluetooth® module's capabilities. Here is an example of how to use the `ArduinoBLE` to create a voltage level monitor application:
10781078

10791079
```arduino
1080-
// Define the voltage service and its characteristic
1081-
BLEService voltageService("1101");
1082-
BLEUnsignedCharCharacteristic voltageLevelChar("2101", BLERead | BLENotify);
1083-
1084-
const int analogPin = A0;
1085-
10861080
/**
10871081
Read voltage level from an analog input of the Nicla Voice,
10881082
then maps the voltage reading to a percentage value ranging from 0 to 100.
10891083
10901084
@param none
10911085
@return the voltage level percentage (int).
10921086
*/
1087+
1088+
#include <ArduinoBLE.h>
1089+
1090+
// Define the voltage service and its characteristic
1091+
BLEService voltageService("1101");
1092+
BLEUnsignedCharCharacteristic voltageLevelChar("2101", BLERead | BLENotify);
1093+
1094+
const int analogPin = A0;
1095+
10931096
int readVoltageLevel() {
10941097
int voltage = analogRead(analogPin);
10951098
int voltageLevel = map(voltage, 0, 1023, 0, 100);

0 commit comments

Comments
 (0)