Skip to content

Commit 7674ff4

Browse files
initial commit
1 parent e82921a commit 7674ff4

File tree

15 files changed

+8721
-0
lines changed

15 files changed

+8721
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ arduinoINS
22
==========
33

44
An Arduino-based INS.
5+
http://randomsenseless.blogspot.de/

arduinosketch/read/read.ino

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <EEPROM.h>
2+
3+
int m = 0;
4+
int n = 0;
5+
6+
// the setup routine runs once when you press reset:
7+
void setup() {
8+
// initialize serial communication at 9600 bits per second:
9+
Serial.begin(9600);
10+
}
11+
12+
// the loop routine runs over and over again forever:
13+
void loop() {
14+
15+
while(n<1024){
16+
m = EEPROM.read(n);
17+
n = n + 1;
18+
Serial.println(m);
19+
}
20+
21+
}

arduinosketch/write/write.ino

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#include <EEPROM.h>
2+
#include <MPU6050.h>
3+
#include <I2Cdev.h>
4+
#include <Wire.h>
5+
6+
MPU6050 accelgyro;
7+
8+
int k = 0;
9+
int n = 1025;
10+
int ax, ay, az;
11+
int gx, gy, gz;
12+
int pushButton = 2;
13+
int led = 13;
14+
15+
// the setup routine runs once when you press reset:
16+
void setup() {
17+
// initialize serial communication at 9600 bits per second:
18+
Serial.begin(9600);
19+
// make the pushbutton's pin an input:
20+
pinMode(pushButton, INPUT);
21+
Wire.begin();
22+
accelgyro.initialize();
23+
pinMode(led, OUTPUT);
24+
digitalWrite(led, LOW);
25+
}
26+
27+
// the loop routine runs over and over again forever:
28+
void loop() {
29+
30+
while(n==1025){
31+
int buttonState = digitalRead(pushButton);
32+
Serial.println(buttonState);
33+
if (buttonState == 1){
34+
n = 0;
35+
digitalWrite(led, HIGH);
36+
Serial.println(buttonState);
37+
}
38+
delay(3);
39+
}
40+
41+
while(n<1024){
42+
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
43+
//Serial.println(ax);
44+
k = (ax/514)+128;
45+
Serial.println(k);
46+
EEPROM.write(n, k);
47+
n = n + 1;
48+
//Serial.println(millis()/1000);
49+
delay(10);
50+
}
51+
52+
}
53+
54+
55+
56+
57+
58+

arduinosketch/write/write.ino~

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#include <EEPROM.h>
2+
#include <MPU6050.h>
3+
#include <I2Cdev.h>
4+
#include <Wire.h>
5+
#include <Servo.h>
6+
7+
MPU6050 accelgyro;
8+
9+
int k = 0;
10+
int n = 1025;
11+
int ax, ay, az;
12+
int gx, gy, gz;
13+
int pushButton = 2;
14+
int led = 13;
15+
16+
// the setup routine runs once when you press reset:
17+
void setup() {
18+
// initialize serial communication at 9600 bits per second:
19+
Serial.begin(9600);
20+
// make the pushbutton's pin an input:
21+
pinMode(pushButton, INPUT);
22+
Wire.begin();
23+
accelgyro.initialize();
24+
pinMode(led, OUTPUT);
25+
digitalWrite(led, LOW);
26+
}
27+
28+
// the loop routine runs over and over again forever:
29+
void loop() {
30+
31+
while(n==1025){
32+
int buttonState = digitalRead(pushButton);
33+
Serial.println(buttonState);
34+
if (buttonState == 1){
35+
n = 0;
36+
digitalWrite(led, HIGH);
37+
Serial.println(buttonState);
38+
}
39+
delay(3);
40+
}
41+
42+
while(n<1024){
43+
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
44+
//Serial.println(ax);
45+
k = (ax/514)+128;
46+
Serial.println(k);
47+
EEPROM.write(n, k);
48+
n = n + 1;
49+
//Serial.println(millis()/1000);
50+
delay(10);
51+
}
52+
53+
}
54+
55+
56+
57+
58+
59+

0 commit comments

Comments
 (0)