-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
143 changed files
with
4,247 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
LED | ||
This example creates a Bluetooth® Low Energy peripheral with service that contains a | ||
characteristic to control an LED. | ||
The circuit: | ||
- Arduino MKR WiFi 1010, Arduino Uno WiFi Rev2 board, Arduino Nano 33 IoT, | ||
Arduino Nano 33 BLE, or Arduino Nano 33 BLE Sense board. | ||
You can use a generic Bluetooth® Low Energy central app, like LightBlue (iOS and Android) or | ||
nRF Connect (Android), to interact with the services and characteristics | ||
created in this sketch. | ||
This example code is in the public domain. | ||
*/ | ||
|
||
#include <ArduinoBLE.h> | ||
|
||
BLEService ledService("19B10000-E8F2-537E-4F6C-D104768A1214"); // Bluetooth® Low Energy LED Service | ||
|
||
// Bluetooth® Low Energy LED Switch Characteristic - custom 128-bit UUID, read and writable by central | ||
BLEByteCharacteristic switchCharacteristic("19B10001-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite); | ||
|
||
const int ledPin = LED_BUILTIN; // pin to use for the LED | ||
|
||
void setup() { | ||
Serial.begin(9600); | ||
while (!Serial); | ||
|
||
// set LED pin to output mode | ||
pinMode(ledPin, OUTPUT); | ||
|
||
// begin initialization | ||
if (!BLE.begin()) { | ||
Serial.println("starting Bluetooth® Low Energy module failed!"); | ||
|
||
while (1); | ||
} | ||
|
||
// set advertised local name and service UUID: | ||
BLE.setLocalName("LED"); | ||
BLE.setAdvertisedService(ledService); | ||
|
||
// add the characteristic to the service | ||
ledService.addCharacteristic(switchCharacteristic); | ||
|
||
// add service | ||
BLE.addService(ledService); | ||
|
||
// set the initial value for the characeristic: | ||
switchCharacteristic.writeValue(0); | ||
|
||
// start advertising | ||
BLE.advertise(); | ||
|
||
Serial.println("BLE LED Peripheral"); | ||
} | ||
|
||
void loop() { | ||
// listen for Bluetooth® Low Energy peripherals to connect: | ||
BLEDevice central = BLE.central(); | ||
|
||
// if a central is connected to peripheral: | ||
if (central) { | ||
Serial.print("Connected to central: "); | ||
// print the central's MAC address: | ||
Serial.println(central.address()); | ||
|
||
// while the central is still connected to peripheral: | ||
while (central.connected()) { | ||
// if the remote device wrote to the characteristic, | ||
// use the value to control the LED: | ||
if (switchCharacteristic.written()) { | ||
if (switchCharacteristic.value()) { // any value other than 0 | ||
Serial.println("LED on"); | ||
digitalWrite(ledPin, HIGH); // will turn the LED on | ||
} else { // a 0 value | ||
Serial.println(F("LED off")); | ||
digitalWrite(ledPin, LOW); // will turn the LED off | ||
} | ||
} | ||
} | ||
|
||
// when the central disconnects, print it out: | ||
Serial.print(F("Disconnected from central: ")); | ||
Serial.println(central.address()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"cpu": { | ||
"fqbn": "", | ||
"name": "", | ||
"type": "" | ||
}, | ||
"secrets": [], | ||
"included_libs": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
# SWEATsens | ||
# SWEATsens | ||
|
||
2023 NE FYDP Group 13 | ||
|
||
Contains Arduino Code for the board and the Flutter app for communicating with the board. | ||
|
||
Currently contains code from: | ||
|
||
https://github.com/lupyuen/flutter-blue-sample | ||
https://github.com/lmarceau/flutter-bluetooth | ||
|
||
as well as Arduino examples. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# The .vscode folder contains launch configuration and tasks you configure in | ||
# VS Code which you may wish to be included in version control, so this line | ||
# is commented out by default. | ||
#.vscode/ | ||
|
||
# Flutter/Dart/Pub related | ||
**/doc/api/ | ||
.dart_tool/ | ||
.flutter-plugins | ||
.flutter-plugins-dependencies | ||
.packages | ||
.pub-cache/ | ||
.pub/ | ||
/build/ | ||
|
||
# Web related | ||
lib/generated_plugin_registrant.dart | ||
|
||
# Exceptions to above rules. | ||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# flutter-blue-sample | ||
|
||
Sample Flutter App for Android and iOS that scans for Bluetooth LE devices and displays the services published by the devices. | ||
|
||
Based on https://github.com/pauldemarco/flutter_blue/tree/master/example | ||
|
||
Read the article... | ||
|
||
[_"Your First Bluetooth Low Energy App with Flutter"_](https://lupyuen.github.io/pinetime-rust-mynewt/articles/flutter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
gradle-wrapper.jar | ||
/.gradle | ||
/captures/ | ||
/gradlew | ||
/gradlew.bat | ||
/local.properties | ||
GeneratedPluginRegistrant.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
def localProperties = new Properties() | ||
def localPropertiesFile = rootProject.file('local.properties') | ||
if (localPropertiesFile.exists()) { | ||
localPropertiesFile.withReader('UTF-8') { reader -> | ||
localProperties.load(reader) | ||
} | ||
} | ||
|
||
def flutterRoot = localProperties.getProperty('flutter.sdk') | ||
if (flutterRoot == null) { | ||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | ||
} | ||
|
||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') | ||
if (flutterVersionCode == null) { | ||
flutterVersionCode = '1' | ||
} | ||
|
||
def flutterVersionName = localProperties.getProperty('flutter.versionName') | ||
if (flutterVersionName == null) { | ||
flutterVersionName = '1.0' | ||
} | ||
|
||
apply plugin: 'com.android.application' | ||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | ||
|
||
android { | ||
compileSdkVersion 29 | ||
|
||
lintOptions { | ||
disable 'InvalidPackage' | ||
} | ||
|
||
defaultConfig { | ||
applicationId "com.pauldemarco.flutter_blue_example" | ||
minSdkVersion 19 | ||
targetSdkVersion 29 | ||
versionCode flutterVersionCode.toInteger() | ||
versionName flutterVersionName | ||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
// TODO: Add your own signing config for the release build. | ||
// Signing with the debug keys for now, so `flutter run --release` works. | ||
signingConfig signingConfigs.debug | ||
} | ||
} | ||
} | ||
|
||
flutter { | ||
source '../..' | ||
} | ||
|
||
dependencies { | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'androidx.test:runner:1.2.0' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' | ||
} |
14 changes: 14 additions & 0 deletions
14
...ndroid/app/src/androidTest/java/com/pauldemarco/flutter_blue/EmbeddingV1ActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.flutter.plugins.firebase.core; | ||
|
||
import androidx.test.rule.ActivityTestRule; | ||
import dev.flutter.plugins.e2e.FlutterRunner; | ||
import com.pauldemarco.flutter_blue_example.EmbeddingV1Activity; | ||
import org.junit.Rule; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(FlutterRunner.class) | ||
public class EmbeddingV1ActivityTest { | ||
@Rule | ||
public ActivityTestRule<EmbeddingV1Activity> rule = | ||
new ActivityTestRule<>(EmbeddingV1Activity.class); | ||
} |
12 changes: 12 additions & 0 deletions
12
...er/android/app/src/androidTest/java/com/pauldemarco/flutter_blue/FlutterActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package io.flutter.plugins.firebase.core; | ||
|
||
import androidx.test.rule.ActivityTestRule; | ||
import dev.flutter.plugins.e2e.FlutterRunner; | ||
import org.junit.Rule; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(FlutterRunner.class) | ||
public class FlutterActivityTest { | ||
// Replace `MainActivity` with `io.flutter.embedding.android.FlutterActivity` if you removed `MainActivity`. | ||
@Rule public ActivityTestRule<io.flutter.embedding.android.FlutterActivity> rule = new ActivityTestRule<>(io.flutter.embedding.android.FlutterActivity.class); | ||
} |
7 changes: 7 additions & 0 deletions
7
flutter-blue-sample-master/android/app/src/debug/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.pauldemarco.flutter_blue_example"> | ||
<!-- Flutter needs it to communicate with the running application | ||
to allow setting breakpoints, to provide hot reload, etc. | ||
--> | ||
<uses-permission android:name="android.permission.INTERNET"/> | ||
</manifest> |
40 changes: 40 additions & 0 deletions
40
flutter-blue-sample-master/android/app/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.pauldemarco.flutter_blue_example"> | ||
<!-- io.flutter.app.FlutterApplication is an android.app.Application that | ||
calls FlutterMain.startInitialization(this); in its onCreate method. | ||
In most cases you can leave this as-is, but you if you want to provide | ||
additional functionality it is fine to subclass or reimplement | ||
FlutterApplication and put your custom class here. --> | ||
<application | ||
android:name="io.flutter.app.FlutterApplication" | ||
android:label="flutter_blue_example" | ||
android:icon="@mipmap/ic_launcher"> | ||
<activity | ||
android:name="io.flutter.embedding.android.FlutterActivity" | ||
android:launchMode="singleTop" | ||
android:theme="@style/LaunchTheme" | ||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" | ||
android:hardwareAccelerated="true" | ||
android:windowSoftInputMode="adjustResize"> | ||
<!-- This keeps the window background of the activity showing | ||
until Flutter renders its first frame. It can be removed if | ||
there is no splash screen (such as the default splash screen | ||
defined in @style/LaunchTheme). --> | ||
<meta-data | ||
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame" | ||
android:value="true" /> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name=".EmbeddingV1Activity" | ||
android:theme="@android:style/Theme.Black.NoTitleBar" | ||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection" | ||
android:hardwareAccelerated="true" | ||
android:windowSoftInputMode="adjustResize"> | ||
</activity> | ||
<meta-data android:name="flutterEmbedding" android:value="2"/> | ||
</application> | ||
</manifest> |
15 changes: 15 additions & 0 deletions
15
...r/android/app/src/main/java/com/pauldemarco/flutter_blue_example/EmbeddingV1Activity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.pauldemarco.flutter_blue_example; | ||
|
||
import android.os.Bundle; | ||
import dev.flutter.plugins.e2e.E2EPlugin; | ||
import io.flutter.app.FlutterActivity; | ||
import com.pauldemarco.flutter_blue.FlutterBluePlugin; | ||
|
||
public class EmbeddingV1Activity extends FlutterActivity { | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
FlutterBluePlugin.registerWith(registrarFor("com.pauldemarco.flutter_blue.FlutterBluePlugin")); | ||
E2EPlugin.registerWith(registrarFor("dev.flutter.plugins.e2e.E2EPlugin")); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
flutter-blue-sample-master/android/app/src/main/res/drawable/launch_background.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Modify this file to customize your launch splash screen --> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:drawable="@android:color/white" /> | ||
|
||
<!-- You can insert your own image assets here --> | ||
<!-- <item> | ||
<bitmap | ||
android:gravity="center" | ||
android:src="@mipmap/launch_image" /> | ||
</item> --> | ||
</layer-list> |
Binary file added
BIN
+544 Bytes
flutter-blue-sample-master/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+442 Bytes
flutter-blue-sample-master/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+721 Bytes
flutter-blue-sample-master/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.01 KB
flutter-blue-sample-master/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.41 KB
flutter-blue-sample-master/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions
8
flutter-blue-sample-master/android/app/src/main/res/values/styles.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> | ||
<!-- Show a splash screen on the activity. Automatically removed when | ||
Flutter draws its first frame --> | ||
<item name="android:windowBackground">@drawable/launch_background</item> | ||
</style> | ||
</resources> |
7 changes: 7 additions & 0 deletions
7
flutter-blue-sample-master/android/app/src/profile/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.pauldemarco.flutter_blue_example"> | ||
<!-- Flutter needs it to communicate with the running application | ||
to allow setting breakpoints, to provide hot reload, etc. | ||
--> | ||
<uses-permission android:name="android.permission.INTERNET"/> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
buildscript { | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
classpath 'com.android.tools.build:gradle:3.5.0' | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
} | ||
|
||
rootProject.buildDir = '../build' | ||
subprojects { | ||
project.buildDir = "${rootProject.buildDir}/${project.name}" | ||
} | ||
subprojects { | ||
project.evaluationDependsOn(':app') | ||
} | ||
|
||
task clean(type: Delete) { | ||
delete rootProject.buildDir | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
org.gradle.jvmargs=-Xmx1536M | ||
android.enableR8=true | ||
android.useAndroidX=true | ||
android.enableJetifier=true |
Oops, something went wrong.