-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#initial version upload - version 0.0.1
Signed-off-by: tuna <[email protected]>
- Loading branch information
Showing
34 changed files
with
5,899 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
### VisualStudioCode ### | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
#JSON | ||
*.json | ||
|
||
|
||
|
||
|
||
# End of https://www.gitignore.io/api/c,c++,visualstudiocode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include <MODI.h> | ||
|
||
const unsigned int NETWORK_ID = 0xF9; // please modify id to your module's id | ||
|
||
/* Network module */ | ||
Network network1; | ||
|
||
void setup() { | ||
// put your setup code here, to run once: | ||
delay(1000); | ||
Serial.begin(115200); | ||
Serial.println("welcome to MODI"); | ||
MODI.begin(); | ||
|
||
network1.begin(NETWORK_ID); | ||
|
||
/* add request */ | ||
network1.addRequest(2); | ||
network1.addRequest(3); | ||
} | ||
|
||
void loop() { | ||
// put your main code here, to run repeatedly: | ||
if(network1.readEvent() == 1) | ||
{ | ||
Serial.println("Button Pressed"); | ||
network1.writeEvent(1); // buzzer on | ||
} | ||
else if(network1.readEvent() == 2) // joystick up | ||
{ | ||
Serial.println("Joystick Up Pressed"); | ||
} | ||
else if(network1.readEvent() == 3) // joystick down | ||
{ | ||
Serial.println("Joystick Down Pressed"); | ||
} | ||
else if(network1.readEvent() == 4) // joystick right | ||
{ | ||
Serial.println("Joystick Right Pressed"); | ||
} | ||
else if(network1.readEvent() == 5) // joystick left | ||
{ | ||
Serial.println("Joystick Left Pressed"); | ||
} | ||
else | ||
{ | ||
network1.writeEvent(0); // buzzer off | ||
} | ||
delay(100); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include <MODI.h> | ||
|
||
const unsigned int ENV_ID = 0x5A6; // please modify id to your module's id | ||
|
||
/* Environment module */ | ||
Environment env1; | ||
|
||
void setup() { | ||
// put your setup code here, to run once: | ||
delay(1000); | ||
Serial.begin(115200); | ||
Serial.println("welcome to MODI"); | ||
MODI.begin(); | ||
|
||
env1.begin(ENV_ID); | ||
|
||
/* add request */ | ||
env1.addRequest(2); | ||
env1.addRequest(3); | ||
env1.addRequest(4); | ||
env1.addRequest(5); | ||
env1.addRequest(6); | ||
env1.addRequest(7); | ||
} | ||
|
||
void loop() { | ||
Serial.println("==============="); | ||
Serial.print("Illuminance"); | ||
Serial.println(env1.readIlluminance()); | ||
Serial.print("red"); | ||
Serial.println(env1.readRed()); | ||
Serial.print("green"); | ||
Serial.println(env1.readGreen()); | ||
Serial.print("blue"); | ||
Serial.println(env1.readBlue()); | ||
Serial.print("temp"); | ||
Serial.println(env1.readTemperature()); | ||
Serial.print("humidity"); | ||
Serial.println(env1.readHumidity()); | ||
delay(100); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include <MODI.h> | ||
|
||
const unsigned int GYRO_ID = 0xE51; // please modify id to your module's id | ||
|
||
/* Gyro module */ | ||
Gyro gyro1; | ||
|
||
void setup() { | ||
// put your setup code here, to run once: | ||
delay(1000); | ||
Serial.begin(115200); | ||
Serial.println("welcome to MODI"); | ||
MODI.begin(); | ||
|
||
gyro1.begin(GYRO_ID); | ||
|
||
/* add request */ | ||
gyro1.addRequest(2); | ||
gyro1.addRequest(3); | ||
gyro1.addRequest(4); | ||
gyro1.addRequest(5); | ||
gyro1.addRequest(6); | ||
gyro1.addRequest(7); | ||
gyro1.addRequest(8); | ||
gyro1.addRequest(9); | ||
gyro1.addRequest(10); | ||
gyro1.addRequest(11); | ||
} | ||
|
||
void loop() { | ||
Serial.println("==============="); | ||
Serial.print("Roll:"); | ||
Serial.println(gyro1.readRoll()); | ||
Serial.print("Pitch:"); | ||
Serial.println(gyro1.readPitch()); | ||
Serial.print("Yaw:"); | ||
Serial.println(gyro1.readYaw()); | ||
Serial.print("Gyro_X axis:"); | ||
Serial.println(gyro1.readGyro_X()); | ||
Serial.print("Gyro_Y axis:"); | ||
Serial.println(gyro1.readGyro_Y()); | ||
Serial.print("Gyro_Z axis:"); | ||
Serial.println(gyro1.readGyro_Z()); | ||
Serial.print("Accel_X axis:"); | ||
Serial.println(gyro1.readAccel_X()); | ||
Serial.print("Accel_Y axis:"); | ||
Serial.println(gyro1.readAccel_Y()); | ||
Serial.print("Accel_Z axis:"); | ||
Serial.println(gyro1.readAccel_Z()); | ||
Serial.print("Vibration:"); | ||
Serial.println(gyro1.readVibration()); | ||
delay(100); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <MODI.h> | ||
|
||
const unsigned int MIC_ID = 0xCEE; // please modify id to your module's id | ||
|
||
/* Mic module */ | ||
Mic mic1; | ||
|
||
void setup() { | ||
// put your setup code here, to run once: | ||
delay(1000); | ||
Serial.begin(115200); | ||
Serial.println("welcome to MODI"); | ||
MODI.begin(); | ||
|
||
mic1.begin(MIC_ID); | ||
|
||
/* add request */ | ||
mic1.addRequest(2); | ||
mic1.addRequest(3); | ||
|
||
} | ||
|
||
void loop() { | ||
Serial.println("==============="); | ||
Serial.print("Volume:"); | ||
Serial.println(mic1.readVolume()); | ||
Serial.print("Freq:"); | ||
Serial.println(mic1.readFreq()); | ||
delay(100); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include <MODI.h> | ||
|
||
const unsigned int BUTTON_ID = 0xF55; // please modify id to your module's id | ||
|
||
/* Button module */ | ||
Button button1; | ||
|
||
void setup() { | ||
// put your setup code here, to run once: | ||
delay(1000); | ||
Serial.begin(115200); | ||
Serial.println("welcome to MODI"); | ||
MODI.begin(); | ||
|
||
button1.begin(BUTTON_ID); | ||
|
||
/* add request */ | ||
button1.addRequest(2); | ||
button1.addRequest(3); | ||
button1.addRequest(4); | ||
button1.addRequest(5); | ||
|
||
} | ||
|
||
void loop() { | ||
Serial.println("==============="); | ||
|
||
if(button1.readClick() > 1.0) | ||
{ | ||
Serial.println("Button is clicked"); | ||
} | ||
else | ||
{ | ||
Serial.println("Button is unclicked"); | ||
} | ||
if(button1.readDoubleClick() > 1.0) | ||
{ | ||
Serial.println("Button is double clicked"); | ||
} | ||
else | ||
{ | ||
Serial.println("Button is not double clicked"); | ||
} | ||
if(button1.readPushState() > 1.0) | ||
{ | ||
Serial.println("Button is pressed"); | ||
} | ||
else | ||
{ | ||
Serial.println("Button is unpressed"); | ||
} | ||
|
||
Serial.println("Button is toggle State:"); | ||
Serial.println(button1.readToggle()); | ||
|
||
delay(100); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <MODI.h> | ||
|
||
const unsigned int DIAL_ID = 0xA18; // please modify id to your module's id | ||
|
||
/* Dial module */ | ||
Dial dial1; | ||
|
||
void setup() { | ||
// put your setup code here, to run once: | ||
delay(1000); | ||
Serial.begin(115200); | ||
Serial.println("welcome to MODI"); | ||
MODI.begin(); | ||
|
||
dial1.begin(DIAL_ID); | ||
|
||
/* add request */ | ||
dial1.addRequest(2); | ||
dial1.addRequest(3); | ||
} | ||
|
||
void loop() { | ||
Serial.println("==============="); | ||
|
||
Serial.print("Dial :"); | ||
Serial.println(dial1.readDegree()); | ||
Serial.print("Dial Turn Speed :"); | ||
Serial.println(dial1.readTurnSpeed()); | ||
delay(100); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <MODI.h> | ||
|
||
const unsigned int ULTRA_ID = 0x577; // please modify id to your module's id | ||
|
||
/* Ultrasonic module */ | ||
Ultrasonic ultra1; | ||
|
||
void setup() { | ||
// put your setup code here, to run once: | ||
delay(1000); | ||
Serial.begin(115200); | ||
Serial.println("welcome to MODI"); | ||
MODI.begin(); | ||
|
||
ultra1.begin(ULTRA_ID); | ||
|
||
/* add request */ | ||
ultra1.addRequest(2); | ||
} | ||
|
||
void loop() { | ||
Serial.println("==============="); | ||
|
||
Serial.print("Dial :"); | ||
Serial.println(ultra1.readDistance()); | ||
delay(100); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <MODI.h> | ||
|
||
const unsigned int IR_ID = 0xE; // please modify id to your module's id | ||
|
||
/* Infrared module */ | ||
Ir ir1; | ||
|
||
void setup() { | ||
// put your setup code here, to run once: | ||
delay(1000); | ||
Serial.begin(115200); | ||
Serial.println("welcome to MODI"); | ||
MODI.begin(); | ||
|
||
ir1.begin(IR_ID); | ||
|
||
/* add request */ | ||
ir1.addRequest(2); | ||
} | ||
|
||
void loop() { | ||
Serial.println("==============="); | ||
|
||
Serial.print("Proximity :"); | ||
Serial.println(ir1.readProximity()); | ||
delay(100); | ||
} |
Oops, something went wrong.