// Diese Software testet die verschiedenen Funktionen des NUClight V3 Boards
// BULME Graz,
// by F. Wolf 01.11.2019
/*
PIN-OUT-NUClight
NUCLEO-L432KC
RGB-rot D1|-------| VIn
RGB-gruen D0| | GND
NRST| | RST
GND| | 5V0
LED1 <-D2| | A7
LED2 <-D3| | A6 -> LED7
SDA (I2C) (MPU6050 gyro) <- D4| | A5
SCL (I2C) (MPU6050 gyro) <- D5| | A4
LED3 <-D6| | A3 -> POTI
nc D7| | A2 -> Taster
nc D8| | A1 -> Taster
LED4 D9| | A0 -> DS18B20
RGB-blau <- D10| | ARF
LED5 <- D11| | 3V0
LED6 <- D12|-------| D13 -> LED8
RGB LED aktiv hight (1)
*/
/*
;platformio.ini
monitor_speed = 9600
monitor_port = COM3
upload_speed = 115200
upload_port = COM3
lib_deps =
# Using library Id
220
# Using library Name
MPU6050
# Depend on specific version
MPU6050@5c63e20c50
*/
#include "mbed.h"
#include "MPU6050.h" //MPU6050 by Erik Olieman
//****** Definitionen **********************
Serial pc(SERIAL_TX,SERIAL_RX); //nucleo
// GY-521 Module MPU-6050 3-Achsen-Gyroskop + 3 Achsen Accelerometre
MPU6050 ark(D4,D5); // MPU6050(PinName sda, PinName scl);
// ********** Hauptprogramm **************
int main()
{
pc.printf("******** TEST-SW *************\r\n"); //HTerm Welcome Message
pc.printf("TEST-MPU6050\r\n"); //HTerm Welcome Message
pc.printf("*******************************\r\n"); //HTerm Welcome Message
while(1)
{
wait(1);
// *** MPU6050 (gyro) TEST
// reading Temprature
float temp = ark.getTemp();
pc.printf("MPU6050-temprature = %0.2f ^C\r\n",temp);
pc.printf("__________________\r\n");
//reading Gyrometer readings
float gyro[3];
ark.getGyro(gyro);
pc.printf("Gyroscope\r\n");
pc.printf("__________________\r\n");
pc.printf("Gyro0=%0.3f, Gyro1=%0.3f, Gyro2=%0.3f\r\n",gyro[0],gyro[1],gyro[2]);
//reading Acclerometer readings
float acce[3];
ark.getAccelero(acce);
pc.printf("Accelerometer\r\n");
pc.printf("__________________\r\n");
pc.printf("Acce0=%0.3f, Acce1=%0.3f, Acce2=%0.3f\r\n",acce[0],acce[1],acce[2]);
wait(1); //wait 1000ms
}
}
/******************** ENDE ***********************/