mirror of
https://github.com/Mercantec-GHC/h5-projekt-mst.git
synced 2026-08-26 21:27:38 +02:00
add arduino project
This commit is contained in:
parent
546c2baeff
commit
fea7a1712a
1
gyroscope-test/.gitignore
vendored
Normal file
1
gyroscope-test/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
build
|
||||
15
gyroscope-test/Makefile
Normal file
15
gyroscope-test/Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
compile:
|
||||
arduino-cli compile --build-path build/ --verbose --warnings all
|
||||
|
||||
upload:
|
||||
arduino-cli compile --build-path build/ --verbose --warnings all --upload
|
||||
|
||||
monitor:
|
||||
arduino-cli monitor -p /dev/ttyACM0
|
||||
|
||||
graph:
|
||||
arduino-cli monitor -p /dev/ttyACM0 | graphstream "255,255,0;0,0,255;0,255,0;0,255,255;255,0,255;255,0,0"
|
||||
|
||||
clean:
|
||||
rm -rf build/
|
||||
45
gyroscope-test/gyroscope-test.ino
Normal file
45
gyroscope-test/gyroscope-test.ino
Normal file
@ -0,0 +1,45 @@
|
||||
#include <Arduino_MKRIoTCarrier.h>
|
||||
|
||||
MKRIoTCarrier carrier;
|
||||
|
||||
[[noreturn]] void halt()
|
||||
{
|
||||
while (true) {
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
if (carrier.begin() != 0) {
|
||||
Serial.println("error: carrier.begin() failed");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
String& operator<<(String& rhs, T&& lhs)
|
||||
{
|
||||
rhs += lhs;
|
||||
return rhs;
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if (carrier.IMUmodule.accelerationAvailable()
|
||||
&& carrier.IMUmodule.gyroscopeAvailable()) {
|
||||
|
||||
float x, y, z;
|
||||
float a, b, c;
|
||||
carrier.IMUmodule.readAcceleration(x, y, z);
|
||||
carrier.IMUmodule.readGyroscope(a, b, c);
|
||||
|
||||
String packet;
|
||||
packet
|
||||
<< x * 200
|
||||
<< ";" << y * 200
|
||||
<< ";" << z * 200
|
||||
<< ";" << a
|
||||
<< ";" << b
|
||||
<< ";" << c;
|
||||
Serial.println(packet);
|
||||
}
|
||||
}
|
||||
26
gyroscope-test/sketch.yaml
Normal file
26
gyroscope-test/sketch.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
profiles:
|
||||
mkr:
|
||||
fqbn: arduino:samd:mkrwifi1010
|
||||
platforms:
|
||||
- platform: arduino:samd (1.8.14)
|
||||
libraries:
|
||||
- dependency: Adafruit BusIO (1.17.4)
|
||||
- dependency: Adafruit DotStar (1.2.5)
|
||||
- dependency: Adafruit GFX Library (1.12.5)
|
||||
- dependency: Adafruit ST7735 and ST7789 Library (1.11.0)
|
||||
- dependency: Adafruit seesaw Library (1.7.9)
|
||||
- dependency: Arduino_APDS9960 (1.0.4)
|
||||
- dependency: Arduino_BQ24195 (0.9.2)
|
||||
- dependency: Arduino_HTS221 (1.0.0)
|
||||
- dependency: Arduino_LPS22HB (1.0.2)
|
||||
- dependency: Arduino_LSM6DS3 (1.0.3)
|
||||
- dependency: Arduino_LSM6DSOX (1.1.2)
|
||||
- dependency: Arduino_MCHPTouch (1.2.3)
|
||||
- Arduino_MKRIoTCarrier (2.1.0)
|
||||
- dependency: BSEC Software Library (1.8.1492)
|
||||
- dependency: SD (1.3.0)
|
||||
- dependency: TFT_eSPI (2.5.43)
|
||||
|
||||
default_profile: mkr
|
||||
default_fqbn: arduino:samd:mkrwifi1010
|
||||
default_port: /dev/ttyACM0
|
||||
Loading…
x
Reference in New Issue
Block a user