mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.3.5 GY521
This commit is contained in:
parent
7c46024ef6
commit
8eea2d1faa
@ -2,6 +2,10 @@ compile:
|
||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||
platforms:
|
||||
- uno
|
||||
- leonardo
|
||||
- due
|
||||
- zero
|
||||
# - due
|
||||
# - zero
|
||||
# - leonardo
|
||||
- m4
|
||||
- esp32
|
||||
# - esp8266
|
||||
# - mega2560
|
@ -4,10 +4,14 @@ name: Arduino CI
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
arduino_ci:
|
||||
runTest:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: Arduino-CI/action@master
|
||||
# Arduino-CI/action@v0.1.1
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6
|
||||
- run: |
|
||||
gem install arduino_ci
|
||||
arduino_ci.rb
|
||||
|
@ -22,6 +22,7 @@
|
||||
// 0.3.2 2021-07-05 fix #20 support multiWire
|
||||
// 0.3.3 2021-07-05 fix #22 improve maths
|
||||
// 0.3.4 2021-07-12 fix #24 improve precision
|
||||
// 0.3.5 2021-10-20 update build-CI, badges + #28 add wakeup to begin().
|
||||
|
||||
|
||||
#include "GY521.h"
|
||||
@ -52,7 +53,11 @@ GY521::GY521(uint8_t address, TwoWire *wire)
|
||||
bool GY521::begin(uint8_t sda, uint8_t scl)
|
||||
{
|
||||
_wire->begin(sda, scl);
|
||||
return isConnected();
|
||||
if (isConnected())
|
||||
{
|
||||
return wakeup();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -60,7 +65,11 @@ bool GY521::begin(uint8_t sda, uint8_t scl)
|
||||
bool GY521::begin()
|
||||
{
|
||||
_wire->begin();
|
||||
return isConnected();
|
||||
if (isConnected())
|
||||
{
|
||||
return wakeup();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "Wire.h"
|
||||
|
||||
|
||||
#define GY521_LIB_VERSION (F("0.3.4"))
|
||||
#define GY521_LIB_VERSION (F("0.3.5"))
|
||||
|
||||
|
||||
#ifndef GY521_THROTTLE_TIME
|
||||
|
@ -1,5 +1,7 @@
|
||||
|
||||
[![Arduino CI](https://github.com/RobTillaart/GY521/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
||||
[![Arduino-lint](https://github.com/RobTillaart/GY521/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/GY521/actions/workflows/arduino-lint.yml)
|
||||
[![JSON check](https://github.com/RobTillaart/GY521/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/GY521/actions/workflows/jsoncheck.yml)
|
||||
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/GY521/blob/master/LICENSE)
|
||||
[![GitHub release](https://img.shields.io/github/release/RobTillaart/GY521.svg?maxAge=3600)](https://github.com/RobTillaart/GY521/releases)
|
||||
|
||||
|
@ -5,12 +5,14 @@
|
||||
// PURPOSE: demo PRY
|
||||
// DATE: 2020-08-06
|
||||
|
||||
|
||||
#include "GY521.h"
|
||||
|
||||
GY521 sensor(0x69);
|
||||
|
||||
uint32_t counter = 0;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
@ -31,7 +33,7 @@ void setup()
|
||||
sensor.setThrottle();
|
||||
Serial.println("start...");
|
||||
|
||||
// set callibration values from calibration sketch.
|
||||
// set calibration values from calibration sketch.
|
||||
sensor.axe = 0;
|
||||
sensor.aye = 0;
|
||||
sensor.aze = 0;
|
||||
@ -40,6 +42,7 @@ void setup()
|
||||
sensor.gze = 0;
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
sensor.read();
|
||||
@ -64,4 +67,6 @@ void loop()
|
||||
counter++;
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
// PURPOSE: read the calibration values / errors for a flat sensor.
|
||||
// DATE: 2020-07-14
|
||||
|
||||
|
||||
#include "GY521.h"
|
||||
|
||||
GY521 sensor(0x69);
|
||||
@ -15,6 +16,7 @@ float ax, ay, az;
|
||||
float gx, gy, gz;
|
||||
float t;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
@ -31,7 +33,7 @@ void setup()
|
||||
sensor.setGyroSensitivity(0); // 250 degrees/s
|
||||
sensor.setThrottle(false);
|
||||
|
||||
// set all callibration errors to zero
|
||||
// set all calibration errors to zero
|
||||
sensor.axe = 0;
|
||||
sensor.aye = 0;
|
||||
sensor.aze = 0;
|
||||
@ -42,6 +44,7 @@ void setup()
|
||||
Serial.println("\n\nReading calibration numbers...");
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
ax = ay = az = 0;
|
||||
@ -107,4 +110,6 @@ void loop()
|
||||
delay(100);
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -5,12 +5,14 @@
|
||||
// PURPOSE: minimal demo
|
||||
// DATE: 2020-07-01
|
||||
|
||||
|
||||
#include "GY521.h"
|
||||
|
||||
GY521 sensor(0x69);
|
||||
|
||||
uint32_t counter = 0;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
@ -31,7 +33,7 @@ void setup()
|
||||
sensor.setThrottle();
|
||||
Serial.println("start...");
|
||||
|
||||
// set callibration values from calibration sketch.
|
||||
// set calibration values from calibration sketch.
|
||||
sensor.axe = 0;
|
||||
sensor.aye = 0;
|
||||
sensor.aze = 0;
|
||||
@ -78,4 +80,6 @@ void loop()
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -5,10 +5,12 @@
|
||||
// PURPOSE: test set/get
|
||||
// DATE: 2020-08-06
|
||||
|
||||
|
||||
#include "GY521.h"
|
||||
|
||||
GY521 sensor(0x69);
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
@ -75,8 +77,11 @@ void setup()
|
||||
Serial.println("\nDone...");
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/GY521.git"
|
||||
},
|
||||
"version": "0.3.4",
|
||||
"version": "0.3.5",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "*"
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=GY521
|
||||
version=0.3.4
|
||||
version=0.3.5
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for GY521 angle measurement
|
||||
|
@ -21,6 +21,7 @@
|
||||
// assertNull(actual)
|
||||
// assertNotNull(actual)
|
||||
|
||||
|
||||
#include <ArduinoUnitTests.h>
|
||||
|
||||
|
||||
@ -32,6 +33,7 @@ unittest_setup()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
unittest_teardown()
|
||||
{
|
||||
}
|
||||
@ -40,7 +42,7 @@ unittest_teardown()
|
||||
unittest(test_constructor)
|
||||
{
|
||||
GY521 sensor(0x69);
|
||||
fprintf(stderr, "VERSION: %s\n", GY521_LIB_VERSION);
|
||||
fprintf(stderr, "VERSION: %s\n", (char *) GY521_LIB_VERSION);
|
||||
sensor.begin();
|
||||
assertEqual(GY521_OK, sensor.getError());
|
||||
|
||||
@ -95,7 +97,7 @@ unittest(test_get_set_sensitivity)
|
||||
|
||||
unittest(test_constants)
|
||||
{
|
||||
fprintf(stderr, "VERSION: %s\n", GY521_LIB_VERSION);
|
||||
fprintf(stderr, "VERSION: %s\n", (char *) GY521_LIB_VERSION);
|
||||
|
||||
assertEqual(GY521_OK, 0);
|
||||
assertEqual(GY521_THROTTLED, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user