Initial commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
This is Led brightness control example for ESP32 that uses LED Brightness Control Module in Dabble app.
|
||||
This module allows you to control state of pin. You can make pin HIGH or LOW or can also assign any PWM
|
||||
value to it.
|
||||
|
||||
NOTE: As in esp32 any channel can be configured as a PWM channel hence any first eight pins controlled by Module
|
||||
will be treated as PWM and others will be treated as normal digital pins.
|
||||
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want to
|
||||
use.For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/getting-started-with-dabble/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_LEDCONTROL_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
unsigned long lasttime=0;
|
||||
void setup() {
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
//uncomment if you want to check if paramters read correctly
|
||||
/*Serial.print("Led:");
|
||||
Serial.print(LedControl.getpinNumber());
|
||||
Serial.print('\t');
|
||||
Serial.print("State:"); //0 if led is Off. 1 if led is On.
|
||||
Serial.print(LedControl.getpinState());
|
||||
Serial.print('\t');
|
||||
Serial.print("Brightness:");
|
||||
Serial.println(LedControl.readBrightness());*/
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
|
||||
/*
|
||||
Terminal Module is like a chat box. It allows you to send and receive commands between your
|
||||
board and smartphone.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you
|
||||
want to use. For this first define CUSTOM_SETTINGS followed by defining
|
||||
INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/terminal-module/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_TERMINAL_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
String Serialdata = "";
|
||||
bool dataflag = 0;
|
||||
void setup() {
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
while (Serial.available() != 0)
|
||||
{
|
||||
Serialdata = String(Serialdata + char(Serial.read()));
|
||||
dataflag = 1;
|
||||
}
|
||||
if (dataflag == 1)
|
||||
{
|
||||
Terminal.print(Serialdata);
|
||||
Serialdata = "";
|
||||
dataflag = 0;
|
||||
}
|
||||
if (Terminal.available() != 0)
|
||||
{
|
||||
while (Terminal.available() != 0)
|
||||
{
|
||||
Serial.write(Terminal.read());
|
||||
}
|
||||
Serial.println();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
Gamepad module provides three different mode namely Digital, JoyStick and Accerleometer.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want to
|
||||
use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/game-pad-module/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_GAMEPAD_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
Serial.print("KeyPressed: ");
|
||||
if (GamePad.isUpPressed())
|
||||
{
|
||||
Serial.print("Up");
|
||||
}
|
||||
|
||||
if (GamePad.isDownPressed())
|
||||
{
|
||||
Serial.print("Down");
|
||||
}
|
||||
|
||||
if (GamePad.isLeftPressed())
|
||||
{
|
||||
Serial.print("Left");
|
||||
}
|
||||
|
||||
if (GamePad.isRightPressed())
|
||||
{
|
||||
Serial.print("Right");
|
||||
}
|
||||
|
||||
if (GamePad.isSquarePressed())
|
||||
{
|
||||
Serial.print("Square");
|
||||
}
|
||||
|
||||
if (GamePad.isCirclePressed())
|
||||
{
|
||||
Serial.print("Circle");
|
||||
}
|
||||
|
||||
if (GamePad.isCrossPressed())
|
||||
{
|
||||
Serial.print("Cross");
|
||||
}
|
||||
|
||||
if (GamePad.isTrianglePressed())
|
||||
{
|
||||
Serial.print("Triangle");
|
||||
}
|
||||
|
||||
if (GamePad.isStartPressed())
|
||||
{
|
||||
Serial.print("Start");
|
||||
}
|
||||
|
||||
if (GamePad.isSelectPressed())
|
||||
{
|
||||
Serial.print("Select");
|
||||
}
|
||||
Serial.print('\t');
|
||||
|
||||
int a = GamePad.getAngle();
|
||||
Serial.print("Angle: ");
|
||||
Serial.print(a);
|
||||
Serial.print('\t');
|
||||
int b = GamePad.getRadius();
|
||||
Serial.print("Radius: ");
|
||||
Serial.print(b);
|
||||
Serial.print('\t');
|
||||
float c = GamePad.getXaxisData();
|
||||
Serial.print("x_axis: ");
|
||||
Serial.print(c);
|
||||
Serial.print('\t');
|
||||
float d = GamePad.getYaxisData();
|
||||
Serial.print("y_axis: ");
|
||||
Serial.println(d);
|
||||
Serial.println();
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
Pin State Monitor is made for monitoring status of analog and digital pins of your board.
|
||||
In this example bluetooth is to be connected on HardwareSerial0 for Uno and Nano Boards.
|
||||
|
||||
NOTE: State for only following pins can be seen on Pin State Monitor:
|
||||
| Screen Name | GPIO Pins |
|
||||
| Digital | 2,4,5,12,13,14,15,16,17,18,19,21 |
|
||||
| | 23,25,26,27 |
|
||||
| Analog | 32,33,34,35,36,39 |
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want
|
||||
to use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/pin-state-monitor-module/
|
||||
*/
|
||||
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_PINMONITOR_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
|
||||
|
||||
void setup() {
|
||||
/*
|
||||
NOTE: PinMonitor only displays status of the pins of your board. It does not configure pinMode of the pins.
|
||||
So if there is any necessity to define pinMode then declare it setup as per requirement.
|
||||
*/
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
PinMonitor.sendDigitalData();
|
||||
PinMonitor.sendAnalogData();
|
||||
delayMicroseconds(20);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
MotorControl Module is used to control actuators like DC motors and Servos.
|
||||
|
||||
NOTE: If you are interested in using any other pin as PWM pin then use led channels
|
||||
from channel 4 onwards on ESP32.Because first four channels are for controlling motor and servo from
|
||||
Motor control module of Dabble.
|
||||
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want to
|
||||
use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/motor-control-module/
|
||||
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_MOTORCONTROL_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
|
||||
|
||||
uint8_t pinServo1 = 4;
|
||||
uint8_t pinServo2 = 5;
|
||||
uint8_t pwmMotor1 = 12;
|
||||
uint8_t dir1Motor1 = 13;
|
||||
uint8_t dir2Motor1 = 14;
|
||||
uint8_t pwmMotor2 = 21;
|
||||
uint8_t dir1Motor2 = 22;
|
||||
uint8_t dir2Motor2 = 23;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile. //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
Controls.runServo1(pinServo1);
|
||||
Controls.runServo2(pinServo2);
|
||||
Controls.runMotor1(pwmMotor1,dir1Motor1,dir2Motor1);
|
||||
Controls.runMotor2(pwmMotor2,dir1Motor2,dir2Motor2);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
DabbleInputs module of your smartphone consists of two potentiometers, two slideswitches and two push button.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want to
|
||||
use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/input-module/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_DABBLEINPUTS_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
void setup() {
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
|
||||
Serial.print("Pot1:");
|
||||
Serial.print(Inputs.getPot1Value());
|
||||
Serial.print('\t');
|
||||
Serial.print("Pot2:");
|
||||
Serial.print(Inputs.getPot2Value());
|
||||
Serial.print('\t');
|
||||
Serial.print("SS1:");
|
||||
Serial.print(Inputs.getSlideSwitch1Value());
|
||||
Serial.print('\t');
|
||||
Serial.print("SS2:");
|
||||
Serial.print(Inputs.getSlideSwitch2Value());
|
||||
Serial.print('\t');
|
||||
Serial.print("TS1:");
|
||||
Serial.print(Inputs.getTactileSwitch1Value());
|
||||
Serial.print('\t');
|
||||
Serial.print("TS2:");
|
||||
Serial.print(Inputs.getTactileSwitch2Value());
|
||||
Serial.println();
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
Camera Module allows you to click images and take videos from smartphone by sending commands from your hardware.
|
||||
This function demonstrates functions available in library for camera module.
|
||||
|
||||
Open Serial monitor and follow the instructions printed there to take images and videos in different cases.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want
|
||||
to use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/camera-module-photos-videos/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_CAMERA_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
printMessage();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
//upload code and open serial monitor (reset your board once if you cannot see any message printed on Serial Monitor)
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
|
||||
char a = processSerialdata();
|
||||
if( a == '1')
|
||||
{
|
||||
Camera.setParameters(FRONT,OFF,HIGH_QUALITY,0); //Camera Direction, Flash, quality, Zoom(from 0 to 100%)
|
||||
Camera.captureImage();
|
||||
}
|
||||
if( a == '2')
|
||||
{
|
||||
Camera.flipTo(REAR);
|
||||
Camera.flashMode(OFF);
|
||||
Camera.setQuality(LOW_QUALITY);
|
||||
Camera.captureImage();
|
||||
}
|
||||
if(a == '3')
|
||||
{
|
||||
Camera.flipTo(REAR);
|
||||
Camera.setQuality(HIGH_QUALITY);
|
||||
Camera.zoom(50);
|
||||
Camera.captureImage();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void printMessage()
|
||||
{
|
||||
Serial.println("Enter any number between 1 to 3 for executing task corresponding to that number: ");
|
||||
Serial.println("Tasks executed on sending different numbers are as followed: ");
|
||||
Serial.println("1 - Take a high quality image from front camera with no flash and no zoom.");
|
||||
Serial.println("2 - Take a low quality image from rear camera with Off flash and no zoom");
|
||||
Serial.println("3 - Take a 50% zoomed image from Rear camera with high quality");
|
||||
}
|
||||
|
||||
char processSerialdata()
|
||||
{
|
||||
if(Serial.available()!=0)
|
||||
{
|
||||
return Serial.read();
|
||||
}
|
||||
else
|
||||
{
|
||||
return '0';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
Camera Module allows you to click images and videos from smartphone by sending commands from your board.
|
||||
This function demonstrates functions available in library for camera module.
|
||||
|
||||
Open Serial monitor and follow the instructions printed there to take videos in different settings of camera.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want
|
||||
to use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/camera-module-photos-videos/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_CAMERA_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
printMessage();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
//upload code and open serial monitor (reset your board if you cannot se any message printed on Serial Monitor)
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
char a = processSerialdata();
|
||||
if( a == '1')
|
||||
{
|
||||
Camera.setParameters(FRONT,OFF,HIGH_QUALITY,0); //Direction , Flash, Quality, zoom(0-100%)
|
||||
Camera.startRecording();
|
||||
}
|
||||
if( a == '2')
|
||||
{
|
||||
Camera.flipTo(REAR);
|
||||
Camera.flashMode(AUTO);
|
||||
Camera.setQuality(LOW_QUALITY);
|
||||
Camera.startRecording();
|
||||
}
|
||||
if(a == '3')
|
||||
{
|
||||
Camera.flipTo(REAR);
|
||||
Camera.setQuality(HIGH_QUALITY);
|
||||
Camera.zoom(50);
|
||||
Camera.startRecording();
|
||||
}
|
||||
|
||||
if(a == '4')
|
||||
{
|
||||
Camera.stopRecording();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void printMessage()
|
||||
{
|
||||
Serial.println("Enter any number between 1 to 4 for executing task corresponding to that number: ");
|
||||
Serial.println("Tasks executed on sending different numbers are as followed: ");
|
||||
Serial.println("1 - Take a high quality video from front camera with no flash and no zoom.");
|
||||
Serial.println("2 - Take a low quality video from rear camera with Auto flash");
|
||||
Serial.println("3 - Take a 50% zoomed image from Rear camera with high quality");
|
||||
Serial.println("4 - Stop video recording");
|
||||
}
|
||||
|
||||
char processSerialdata()
|
||||
{
|
||||
if(Serial.available()!=0)
|
||||
{
|
||||
return Serial.read();
|
||||
}
|
||||
else
|
||||
{
|
||||
return '0';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
Accelerometer block of Phone sensor module allows you to access your smartphone's accelerometer values.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you wan to
|
||||
use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/phone-sensors-module/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_SENSOR_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
print_Accelerometer_data();
|
||||
}
|
||||
|
||||
void print_Accelerometer_data()
|
||||
{
|
||||
Serial.print("X_axis: ");
|
||||
Serial.print(Sensor.getAccelerometerXaxis(), 4);
|
||||
Serial.print('\t');
|
||||
Serial.print("Y_axis: ");
|
||||
Serial.print(Sensor.getAccelerometerYaxis(), 4);
|
||||
Serial.print('\t');
|
||||
Serial.print("Z_axis: ");
|
||||
Serial.println(Sensor.getAccelerometerZaxis(), 4);
|
||||
Serial.println();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
If your smartphone has Barometer sensor support then this code helps in accessing that sensor's value through Dabble app.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want to
|
||||
use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/phone-sensors-module/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_SENSOR_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
print_Barometer_data();
|
||||
}
|
||||
|
||||
void print_Barometer_data()
|
||||
{
|
||||
Serial.print("Barometer: ");
|
||||
Serial.println(Sensor.getBarometerPressure(), 7);
|
||||
Serial.println();
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
This module helps you in accessing GPS values of our smartphone.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want
|
||||
to use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/phone-sensors-module/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_SENSOR_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
print_GPS_data();
|
||||
}
|
||||
|
||||
|
||||
void print_GPS_data()
|
||||
{
|
||||
Serial.print("Longitude: ");
|
||||
Serial.print(Sensor.getGPSlongitude(), 7);
|
||||
Serial.print('\t');
|
||||
Serial.print('\t');
|
||||
Serial.print("Latitude: ");
|
||||
Serial.println(Sensor.getGPSLatitude(), 7);
|
||||
Serial.println();
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
With this block of phone sensor module you can access gyroscope values of your smartphone.
|
||||
Gyroscope gives you angular acceleration in x,y and z axis.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want
|
||||
to use. For this first define CUSTOM_SETTINGS followed by defining
|
||||
INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/phone-sensors-module/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_SENSOR_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
print_Gyroscope_data();
|
||||
}
|
||||
|
||||
void print_Gyroscope_data()
|
||||
{
|
||||
Serial.print("X-axis: ");
|
||||
Serial.print(Sensor.getGyroscopeXaxis());
|
||||
Serial.print('\t');
|
||||
Serial.print("Y-axis: ");
|
||||
Serial.print(Sensor.getGyroscopeYaxis());
|
||||
Serial.print('\t');
|
||||
Serial.print("Z-axis: ");
|
||||
Serial.println(Sensor.getGyroscopeZaxis());
|
||||
Serial.println();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
This block gives light intensity sensed by smartphone.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want to
|
||||
use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/phone-sensors-module/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_SENSOR_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
print_Light_data();
|
||||
}
|
||||
|
||||
void print_Light_data()
|
||||
{
|
||||
Serial.print("LIGHT: ");
|
||||
Serial.println(Sensor.getLightIntensity(), 7);
|
||||
Serial.println();
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
Magnetometer block helps in accessing your mobile's magnetometer.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want
|
||||
to use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/phone-sensors-module/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_SENSOR_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
print_Magnetometer_data();
|
||||
}
|
||||
|
||||
void print_Magnetometer_data()
|
||||
{
|
||||
Serial.print("X-axis: ");
|
||||
Serial.print(Sensor.getMagnetometerXaxis(), 7);
|
||||
Serial.print('\t');
|
||||
Serial.print("Y-axis: ");
|
||||
Serial.print(Sensor.getMagnetometerYaxis(), 7);
|
||||
Serial.print('\t');
|
||||
Serial.print("Z-axis: ");
|
||||
Serial.println(Sensor.getMagnetometerZaxis(), 7);
|
||||
Serial.println();
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
Proximity block allows to access proximity sensor of your mobile. This sensor in mobile
|
||||
phone gives two different values depending on the fact is object is near or far. You will get
|
||||
0 reading when object is very close to phone and any random number if object is far.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want
|
||||
to use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/phone-sensors-module/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_SENSOR_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); ////set bluetooth name of your device
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
print_Proximity_data();
|
||||
}
|
||||
|
||||
void print_Proximity_data()
|
||||
{
|
||||
Serial.print("Distance: ");
|
||||
Serial.println(Sensor.getProximityDistance(), 7);
|
||||
Serial.println();
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
Sound sensor gives decibal value of sound that is sensed by your mobile's microphone.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want
|
||||
to use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/phone-sensors-module/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_SENSOR_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("Myesp32"); //set bluetooth name of your device
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
print_Sound_data();
|
||||
}
|
||||
|
||||
void print_Sound_data()
|
||||
{
|
||||
Serial.print("SOUND: ");
|
||||
Serial.println(Sensor.getSoundDecibels(), 3);
|
||||
Serial.println();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
If there is temperature sensor in your smartphone then you can access it through this example.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want
|
||||
to use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/phone-sensors-module/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_SENSOR_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("MyEsp32"); //Enter baudrate of your bluetooth.Connect bluetooth on Bluetooth port present on evive.
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
print_Temperature_data();
|
||||
}
|
||||
|
||||
void print_Temperature_data()
|
||||
{
|
||||
Serial.print("TEMPERATURE: ");
|
||||
Serial.println(Sensor.getTemperature(), 7);
|
||||
Serial.println();
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
Data Logger module helps you in storing data in form of .csv file.
|
||||
Later you can open this file to view your stored data.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want to
|
||||
use.For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_SENSOR_MODULE
|
||||
#define INCLUDE_DATALOGGER_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
bool isFileOpen = true;
|
||||
uint8_t closeFileSignalPin = 2; //this pin is internally pulled up and a push button grounded on one side is connected to pin so that pin detects low logic when push button is pressed.
|
||||
|
||||
void initializeFile(){
|
||||
Serial.println("Initialize");
|
||||
DataLogger.createFile("Microphone");
|
||||
DataLogger.createColumn("Decibel");
|
||||
}
|
||||
|
||||
void setup() {
|
||||
pinMode(closeFileSignalPin,INPUT_PULLUP);
|
||||
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
||||
Dabble.begin("Myesp32"); //set bluetooth name of your device
|
||||
DataLogger.sendSettings(&initializeFile);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
if( isFileOpen == true)
|
||||
{
|
||||
print_Sound_data();
|
||||
DataLogger.send("Decibel",Sensor.getdata_Sound());
|
||||
}
|
||||
if((digitalRead(closeFileSignalPin) == LOW) && isFileOpen == true)
|
||||
{
|
||||
isFileOpen = false;
|
||||
DataLogger.stop();
|
||||
}
|
||||
}
|
||||
|
||||
void print_Sound_data()
|
||||
{
|
||||
Serial.print("SOUND: ");
|
||||
Serial.println(Sensor.getdata_Sound(), 3);
|
||||
Serial.println();
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
Notification module can be used for notifying your mobile about status of various activities happening on your hardware.
|
||||
In this example a push button is connected to a digital pin. And mobile is notified about how many times that push button
|
||||
is pressed.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want to
|
||||
use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/
|
||||
*/
|
||||
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_NOTIFICATION_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
uint8_t pushButtonPin = 2;
|
||||
int counts = 0;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
pinMode(pushButtonPin, INPUT_PULLUP); //Since pin is internally pulled up hence connect one side of push button to ground so whenever button is pushed pin reads LOW logic.
|
||||
Dabble.waitForAppConnection(); //waiting for App to connect
|
||||
Notification.clear(); //clear previous notifictions
|
||||
Notification.setTitle("Button Counts"); //Enter title of your notification
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
if (digitalRead(pushButtonPin) == LOW)
|
||||
{
|
||||
counts++;
|
||||
delay(1000); //debounce delay
|
||||
}
|
||||
Notification.notifyPhone(String("Button has been pressed ") + counts + String (" time"));
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
SMS module uses your smartphone to send SMS based on events occuring in your hardware board.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want to
|
||||
use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/
|
||||
*/
|
||||
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_SMS_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
uint8_t pushButtonPin = 2;
|
||||
|
||||
void setup() {
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
pinMode(pushButtonPin, INPUT_PULLUP); //Since pin is internally pulled up hence connect one side of push button to ground so whenever button is pushed pin reads LOW logic.
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
if(digitalRead(pushButtonPin) == LOW)
|
||||
{
|
||||
SMS.sendMessage("0123456789","Buenas Noches"); //Contact Number, message content
|
||||
delay(1000); //debounce delay
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
This code demonstrates how to use music module. Here a push button is used for playing and stopping music in smartphone.
|
||||
A push button is connected on an internally pulled up digital pin. And a change in state of pin is read.
|
||||
With every press on push button state of music module will be toggled.If no music is played by music module then
|
||||
command to play music module will be sent and if currently music is being played then it will be stopped.
|
||||
|
||||
You can reduce the size of library compiled by enabling only those modules that you want to
|
||||
use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
||||
|
||||
Explore more on: https://thestempedia.com/docs/dabble/
|
||||
|
||||
*/
|
||||
#define CUSTOM_SETTINGS
|
||||
#define INCLUDE_MUSIC_MODULE
|
||||
#include <DabbleESP32.h>
|
||||
|
||||
bool playMusic = false;
|
||||
uint8_t musicSignalPin = 2;
|
||||
bool currentStatusOfPin = 0, prevStatusOfPin = 0; //status of musicSignalPin
|
||||
bool musicIsOn = false;
|
||||
|
||||
void setup() {
|
||||
pinMode(musicSignalPin, INPUT_PULLUP);
|
||||
Dabble.begin("MyEsp32"); //set bluetooth name of your device
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
||||
currentStatusOfPin = digitalRead(musicSignalPin);
|
||||
if (currentStatusOfPin == 0 && prevStatusOfPin == 1) //detecting change in state of pin due to push button
|
||||
{
|
||||
delay(500); // debouncedelay
|
||||
playMusic = !(playMusic);
|
||||
}
|
||||
if (playMusic == true)
|
||||
{
|
||||
if (musicIsOn == false)
|
||||
{
|
||||
Music.play("A4"); //assigned key for Piano Note A4
|
||||
Music.addToQueue("B4"); //assigned key for Piano Note B4
|
||||
Music.addToQueue("C4"); //assigned key for Piano Note C4
|
||||
Music.addToQueue("D4"); //assigned key for Piano Note D4
|
||||
Music.addToQueue("E4"); //assigned key for Piano Note E4
|
||||
Music.addToQueue("F4"); //assigned key for Piano Note F4
|
||||
Music.addToQueue("G4"); //assigned key for Piano Note G4
|
||||
Music.addToQueue("C5"); //assigned key for Piano Note C5 //Select your own music files, assign them key and write this key as written here for various piano notes.
|
||||
musicIsOn = true;
|
||||
}
|
||||
}
|
||||
if (playMusic == false)
|
||||
{
|
||||
Music.stop();
|
||||
musicIsOn = false;
|
||||
}
|
||||
prevStatusOfPin = currentStatusOfPin;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user