Skip to content

Commit 124d97b

Browse files
committed
#initial version upload - version 0.0.1
Signed-off-by: tuna <[email protected]>
1 parent 6bf9001 commit 124d97b

File tree

34 files changed

+5899
-0
lines changed

34 files changed

+5899
-0
lines changed

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### VisualStudioCode ###
2+
.vscode/*
3+
!.vscode/settings.json
4+
!.vscode/tasks.json
5+
!.vscode/launch.json
6+
!.vscode/extensions.json
7+
#JSON
8+
*.json
9+
10+
#pdf
11+
12+
*.pdf
13+
14+
15+
# End of https://www.gitignore.io/api/c,c++,visualstudiocode
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#include <MODI.h>
2+
3+
const unsigned int NETWORK_ID = 0xF9; // please modify id to your module's id
4+
5+
/* Network module */
6+
Network network1;
7+
8+
void setup() {
9+
// put your setup code here, to run once:
10+
delay(1000);
11+
Serial.begin(115200);
12+
Serial.println("welcome to MODI");
13+
MODI.begin();
14+
15+
network1.begin(NETWORK_ID);
16+
17+
/* add request */
18+
network1.addRequest(2);
19+
network1.addRequest(3);
20+
}
21+
22+
void loop() {
23+
// put your main code here, to run repeatedly:
24+
if(network1.readEvent() == 1)
25+
{
26+
Serial.println("Button Pressed");
27+
network1.writeEvent(1); // buzzer on
28+
}
29+
else if(network1.readEvent() == 2) // joystick up
30+
{
31+
Serial.println("Joystick Up Pressed");
32+
}
33+
else if(network1.readEvent() == 3) // joystick down
34+
{
35+
Serial.println("Joystick Down Pressed");
36+
}
37+
else if(network1.readEvent() == 4) // joystick right
38+
{
39+
Serial.println("Joystick Right Pressed");
40+
}
41+
else if(network1.readEvent() == 5) // joystick left
42+
{
43+
Serial.println("Joystick Left Pressed");
44+
}
45+
else
46+
{
47+
network1.writeEvent(0); // buzzer off
48+
}
49+
delay(100);
50+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#include <MODI.h>
2+
3+
const unsigned int ENV_ID = 0x5A6; // please modify id to your module's id
4+
5+
/* Environment module */
6+
Environment env1;
7+
8+
void setup() {
9+
// put your setup code here, to run once:
10+
delay(1000);
11+
Serial.begin(115200);
12+
Serial.println("welcome to MODI");
13+
MODI.begin();
14+
15+
env1.begin(ENV_ID);
16+
17+
/* add request */
18+
env1.addRequest(2);
19+
env1.addRequest(3);
20+
env1.addRequest(4);
21+
env1.addRequest(5);
22+
env1.addRequest(6);
23+
env1.addRequest(7);
24+
}
25+
26+
void loop() {
27+
Serial.println("===============");
28+
Serial.print("Illuminance");
29+
Serial.println(env1.readIlluminance());
30+
Serial.print("red");
31+
Serial.println(env1.readRed());
32+
Serial.print("green");
33+
Serial.println(env1.readGreen());
34+
Serial.print("blue");
35+
Serial.println(env1.readBlue());
36+
Serial.print("temp");
37+
Serial.println(env1.readTemperature());
38+
Serial.print("humidity");
39+
Serial.println(env1.readHumidity());
40+
delay(100);
41+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <MODI.h>
2+
3+
const unsigned int GYRO_ID = 0xE51; // please modify id to your module's id
4+
5+
/* Gyro module */
6+
Gyro gyro1;
7+
8+
void setup() {
9+
// put your setup code here, to run once:
10+
delay(1000);
11+
Serial.begin(115200);
12+
Serial.println("welcome to MODI");
13+
MODI.begin();
14+
15+
gyro1.begin(GYRO_ID);
16+
17+
/* add request */
18+
gyro1.addRequest(2);
19+
gyro1.addRequest(3);
20+
gyro1.addRequest(4);
21+
gyro1.addRequest(5);
22+
gyro1.addRequest(6);
23+
gyro1.addRequest(7);
24+
gyro1.addRequest(8);
25+
gyro1.addRequest(9);
26+
gyro1.addRequest(10);
27+
gyro1.addRequest(11);
28+
}
29+
30+
void loop() {
31+
Serial.println("===============");
32+
Serial.print("Roll:");
33+
Serial.println(gyro1.readRoll());
34+
Serial.print("Pitch:");
35+
Serial.println(gyro1.readPitch());
36+
Serial.print("Yaw:");
37+
Serial.println(gyro1.readYaw());
38+
Serial.print("Gyro_X axis:");
39+
Serial.println(gyro1.readGyro_X());
40+
Serial.print("Gyro_Y axis:");
41+
Serial.println(gyro1.readGyro_Y());
42+
Serial.print("Gyro_Z axis:");
43+
Serial.println(gyro1.readGyro_Z());
44+
Serial.print("Accel_X axis:");
45+
Serial.println(gyro1.readAccel_X());
46+
Serial.print("Accel_Y axis:");
47+
Serial.println(gyro1.readAccel_Y());
48+
Serial.print("Accel_Z axis:");
49+
Serial.println(gyro1.readAccel_Z());
50+
Serial.print("Vibration:");
51+
Serial.println(gyro1.readVibration());
52+
delay(100);
53+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <MODI.h>
2+
3+
const unsigned int MIC_ID = 0xCEE; // please modify id to your module's id
4+
5+
/* Mic module */
6+
Mic mic1;
7+
8+
void setup() {
9+
// put your setup code here, to run once:
10+
delay(1000);
11+
Serial.begin(115200);
12+
Serial.println("welcome to MODI");
13+
MODI.begin();
14+
15+
mic1.begin(MIC_ID);
16+
17+
/* add request */
18+
mic1.addRequest(2);
19+
mic1.addRequest(3);
20+
21+
}
22+
23+
void loop() {
24+
Serial.println("===============");
25+
Serial.print("Volume:");
26+
Serial.println(mic1.readVolume());
27+
Serial.print("Freq:");
28+
Serial.println(mic1.readFreq());
29+
delay(100);
30+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#include <MODI.h>
2+
3+
const unsigned int BUTTON_ID = 0xF55; // please modify id to your module's id
4+
5+
/* Button module */
6+
Button button1;
7+
8+
void setup() {
9+
// put your setup code here, to run once:
10+
delay(1000);
11+
Serial.begin(115200);
12+
Serial.println("welcome to MODI");
13+
MODI.begin();
14+
15+
button1.begin(BUTTON_ID);
16+
17+
/* add request */
18+
button1.addRequest(2);
19+
button1.addRequest(3);
20+
button1.addRequest(4);
21+
button1.addRequest(5);
22+
23+
}
24+
25+
void loop() {
26+
Serial.println("===============");
27+
28+
if(button1.readClick() > 1.0)
29+
{
30+
Serial.println("Button is clicked");
31+
}
32+
else
33+
{
34+
Serial.println("Button is unclicked");
35+
}
36+
if(button1.readDoubleClick() > 1.0)
37+
{
38+
Serial.println("Button is double clicked");
39+
}
40+
else
41+
{
42+
Serial.println("Button is not double clicked");
43+
}
44+
if(button1.readPushState() > 1.0)
45+
{
46+
Serial.println("Button is pressed");
47+
}
48+
else
49+
{
50+
Serial.println("Button is unpressed");
51+
}
52+
53+
Serial.println("Button is toggle State:");
54+
Serial.println(button1.readToggle());
55+
56+
delay(100);
57+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <MODI.h>
2+
3+
const unsigned int DIAL_ID = 0xA18; // please modify id to your module's id
4+
5+
/* Dial module */
6+
Dial dial1;
7+
8+
void setup() {
9+
// put your setup code here, to run once:
10+
delay(1000);
11+
Serial.begin(115200);
12+
Serial.println("welcome to MODI");
13+
MODI.begin();
14+
15+
dial1.begin(DIAL_ID);
16+
17+
/* add request */
18+
dial1.addRequest(2);
19+
dial1.addRequest(3);
20+
}
21+
22+
void loop() {
23+
Serial.println("===============");
24+
25+
Serial.print("Dial :");
26+
Serial.println(dial1.readDegree());
27+
Serial.print("Dial Turn Speed :");
28+
Serial.println(dial1.readTurnSpeed());
29+
delay(100);
30+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <MODI.h>
2+
3+
const unsigned int ULTRA_ID = 0x577; // please modify id to your module's id
4+
5+
/* Ultrasonic module */
6+
Ultrasonic ultra1;
7+
8+
void setup() {
9+
// put your setup code here, to run once:
10+
delay(1000);
11+
Serial.begin(115200);
12+
Serial.println("welcome to MODI");
13+
MODI.begin();
14+
15+
ultra1.begin(ULTRA_ID);
16+
17+
/* add request */
18+
ultra1.addRequest(2);
19+
}
20+
21+
void loop() {
22+
Serial.println("===============");
23+
24+
Serial.print("Dial :");
25+
Serial.println(ultra1.readDistance());
26+
delay(100);
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <MODI.h>
2+
3+
const unsigned int IR_ID = 0xE; // please modify id to your module's id
4+
5+
/* Infrared module */
6+
Ir ir1;
7+
8+
void setup() {
9+
// put your setup code here, to run once:
10+
delay(1000);
11+
Serial.begin(115200);
12+
Serial.println("welcome to MODI");
13+
MODI.begin();
14+
15+
ir1.begin(IR_ID);
16+
17+
/* add request */
18+
ir1.addRequest(2);
19+
}
20+
21+
void loop() {
22+
Serial.println("===============");
23+
24+
Serial.print("Proximity :");
25+
Serial.println(ir1.readProximity());
26+
delay(100);
27+
}

0 commit comments

Comments
 (0)