mirror of
https://github.com/nick7ass/NNMDETGroupProject.git
synced 2025-04-20 04:40:34 +02:00
Both Sensors and connection to unity/esp32 working properly
This commit is contained in:
parent
ff951f3bc5
commit
31e0101562
BIN
.DS_Store
vendored
BIN
.DS_Store
vendored
Binary file not shown.
BIN
Assets/.DS_Store
vendored
BIN
Assets/.DS_Store
vendored
Binary file not shown.
BIN
Assets/1OurESP32Scripts/.DS_Store
vendored
BIN
Assets/1OurESP32Scripts/.DS_Store
vendored
Binary file not shown.
@ -15,6 +15,7 @@ WebsocketsClient client;
|
|||||||
|
|
||||||
bool touchDetected = false; // Flag to track touch detection
|
bool touchDetected = false; // Flag to track touch detection
|
||||||
bool touchHandled = false; // Flag to track if touch has been handled
|
bool touchHandled = false; // Flag to track if touch has been handled
|
||||||
|
bool messageHasBeenSent = false;
|
||||||
|
|
||||||
int touchValue;
|
int touchValue;
|
||||||
|
|
||||||
@ -52,21 +53,21 @@ void loop() {
|
|||||||
if (msg.data().equalsIgnoreCase("Need Touch")) {
|
if (msg.data().equalsIgnoreCase("Need Touch")) {
|
||||||
Serial.println("Reading value from touch sensor!");
|
Serial.println("Reading value from touch sensor!");
|
||||||
//touchValue = touchRead(4);
|
//touchValue = touchRead(4);
|
||||||
Serial.println(touchRead(4));
|
//Serial.println(touchRead(4));
|
||||||
|
|
||||||
while (touchRead(4) < 14000) {
|
while (touchRead(4) < 40000) {
|
||||||
if (touchRead(4) >= 14000) {
|
if (touchRead(4) >= 40000) {
|
||||||
Serial.println("Value above threshold");
|
Serial.println("Value above threshold");
|
||||||
|
|
||||||
rotateServo();
|
rotateServo();
|
||||||
|
|
||||||
client.send(String(touchRead(4)));
|
client.send(String(40000));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delay(500);
|
||||||
}
|
}
|
||||||
client.close();
|
client.close();
|
||||||
}
|
}
|
||||||
@ -76,8 +77,14 @@ void loop() {
|
|||||||
|
|
||||||
void rotateServo() {
|
void rotateServo() {
|
||||||
// Rotate the servo motor 180 degrees
|
// Rotate the servo motor 180 degrees
|
||||||
for (int posDegrees = 0; posDegrees <= 180; posDegrees++) {
|
|
||||||
servo1.write(posDegrees);
|
for (int posDegrees = 0; posDegrees <= 180; posDegrees++) {
|
||||||
delay(10); // Adjust the delay for smooth rotation
|
servo1.write(posDegrees);
|
||||||
}
|
delay(10); // Adjust the delay for smooth rotation
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int posDegrees = 180; posDegrees >= 0; posDegrees--) {
|
||||||
|
servo1.write(posDegrees);
|
||||||
|
delay(10);
|
||||||
|
}
|
||||||
}
|
}
|
BIN
Assets/Lowpoly Flowers/.DS_Store
vendored
Normal file
BIN
Assets/Lowpoly Flowers/.DS_Store
vendored
Normal file
Binary file not shown.
@ -117,7 +117,7 @@ Material:
|
|||||||
- _ZWrite: 1
|
- _ZWrite: 1
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- _BaseColor: {r: 0.6343293, g: 0.39881203, b: 0.716, a: 1}
|
- _BaseColor: {r: 0.6343293, g: 0.39881203, b: 0.716, a: 1}
|
||||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
- _Color: {r: 0.6343293, g: 0.398812, b: 0.716, a: 1}
|
||||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||||
m_BuildTextureStacks: []
|
m_BuildTextureStacks: []
|
||||||
|
@ -117,7 +117,7 @@ Material:
|
|||||||
- _ZWrite: 1
|
- _ZWrite: 1
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- _BaseColor: {r: 0.77464443, g: 0.78431374, b: 0.55363315, a: 1}
|
- _BaseColor: {r: 0.77464443, g: 0.78431374, b: 0.55363315, a: 1}
|
||||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
- _Color: {r: 0.77464443, g: 0.78431374, b: 0.55363315, a: 1}
|
||||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||||
m_BuildTextureStacks: []
|
m_BuildTextureStacks: []
|
||||||
|
BIN
Assets/OurESP32Scripts/.DS_Store
vendored
Normal file
BIN
Assets/OurESP32Scripts/.DS_Store
vendored
Normal file
Binary file not shown.
8
Assets/OurESP32Scripts/TouchServo.meta
Normal file
8
Assets/OurESP32Scripts/TouchServo.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 391343d09cc454bf881e4464a3eeea0b
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -15,6 +15,7 @@ WebsocketsClient client;
|
|||||||
|
|
||||||
bool touchDetected = false; // Flag to track touch detection
|
bool touchDetected = false; // Flag to track touch detection
|
||||||
bool touchHandled = false; // Flag to track if touch has been handled
|
bool touchHandled = false; // Flag to track if touch has been handled
|
||||||
|
bool messageHasBeenSent = false;
|
||||||
|
|
||||||
int touchValue;
|
int touchValue;
|
||||||
|
|
||||||
@ -52,21 +53,21 @@ void loop() {
|
|||||||
if (msg.data().equalsIgnoreCase("Need Touch")) {
|
if (msg.data().equalsIgnoreCase("Need Touch")) {
|
||||||
Serial.println("Reading value from touch sensor!");
|
Serial.println("Reading value from touch sensor!");
|
||||||
//touchValue = touchRead(4);
|
//touchValue = touchRead(4);
|
||||||
Serial.println(touchRead(4));
|
//Serial.println(touchRead(4));
|
||||||
|
|
||||||
while (touchRead(4) < 14000) {
|
while (touchRead(4) < 40000) {
|
||||||
if (touchRead(4) >= 14000) {
|
if (touchRead(4) >= 40000) {
|
||||||
Serial.println("Value above threshold");
|
Serial.println("Value above threshold");
|
||||||
|
|
||||||
rotateServo();
|
rotateServo();
|
||||||
|
|
||||||
client.send(String(touchRead(4)));
|
client.send(String(40000));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delay(500);
|
||||||
}
|
}
|
||||||
client.close();
|
client.close();
|
||||||
}
|
}
|
||||||
@ -76,8 +77,14 @@ void loop() {
|
|||||||
|
|
||||||
void rotateServo() {
|
void rotateServo() {
|
||||||
// Rotate the servo motor 180 degrees
|
// Rotate the servo motor 180 degrees
|
||||||
for (int posDegrees = 0; posDegrees <= 180; posDegrees++) {
|
|
||||||
servo1.write(posDegrees);
|
for (int posDegrees = 0; posDegrees <= 180; posDegrees++) {
|
||||||
delay(10); // Adjust the delay for smooth rotation
|
servo1.write(posDegrees);
|
||||||
}
|
delay(10); // Adjust the delay for smooth rotation
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int posDegrees = 180; posDegrees >= 0; posDegrees--) {
|
||||||
|
servo1.write(posDegrees);
|
||||||
|
delay(10);
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 4ea5e337c5c484077bd7704cb81b5270
|
guid: 310824fe30798457f9bad04704b994bc
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
|
@ -4599,7 +4599,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 297646202}
|
m_GameObject: {fileID: 297646202}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 6.388697, y: -2.6683073, z: -2.4067612}
|
m_LocalPosition: {x: 6.388697, y: -2.32, z: -2.4067612}
|
||||||
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
m_ConstrainProportionsScale: 1
|
m_ConstrainProportionsScale: 1
|
||||||
m_Children:
|
m_Children:
|
||||||
@ -4672,6 +4672,18 @@ MonoBehaviour:
|
|||||||
_whenSelect:
|
_whenSelect:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls:
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 1293977771}
|
||||||
|
m_TargetAssemblyTypeName: Oculus.Interaction.AudioTrigger, Oculus.Interaction.OVR.Samples
|
||||||
|
m_MethodName: PlayAudio
|
||||||
|
m_Mode: 1
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
- m_Target: {fileID: 1726060523}
|
- m_Target: {fileID: 1726060523}
|
||||||
m_TargetAssemblyTypeName: BoundWaterScript, Assembly-CSharp
|
m_TargetAssemblyTypeName: BoundWaterScript, Assembly-CSharp
|
||||||
m_MethodName: stationCompleted
|
m_MethodName: stationCompleted
|
||||||
|
Loading…
x
Reference in New Issue
Block a user