Skip to content

Instantly share code, notes, and snippets.

@rburnett3
rburnett3 / Example sends hardcoded data to Ubidots using an ESP32-DevKitC
Created December 13, 2018 14:41
sends a distance value between an ultrasonic sensor and on the surface of the water detected by an MB7389 HRXL-MaxSonar-WRMT sensor. Then, the value will be managed in Ubidots to calculate the volume of free-flowing substances in the tank.
/*************************************************************************************************
* This Example sends hardcoded data to Ubidots using an ESP32-DevKitC. The code sends a distance
* value between an ultrasonic sensor and on the surface of the water detected by an MB7389
* HRXL-MaxSonar-WRMT sensor. Then, the value will be managed in Ubidots to calculate the volume
* of free-flowing substances in the tank.
*
* This example is given AS IT IS without any warranty.
*
* Made by María Carlina Hernandez.
* Nov 28, 2018.
@rburnett3
rburnett3 / maxsonar-analog-voltage-code.txt
Last active October 14, 2019 16:10
Analog Output MaxSonar Code
print_data();
delay(1000);
}/* Arduino example code for MaxBotix MB7389 HRXL-MaxSonar-WR weather resistant ultrasonic distance sensor: analog voltage output. More info: www.makerguides.com */
#define sensorPin A0
int distance = 0;
void setup() {
Serial.begin(9600);
@rburnett3
rburnett3 / maxsonar-mb1240-analog-voltage
Created October 15, 2019 12:47
maxsonar-mb1240-analog-voltage
/* Arduino example code for MaxBotix MB1240 XL-MaxSonar-EZ4 ultrasonic distance sensor: analog voltage output. More info: www.makerguides.com */
#define sensorPin A0
int distance = 0;
void setup() {
Serial.begin(9600);
}
@rburnett3
rburnett3 / maxsonar-mb1240-pulse-width
Created October 15, 2019 13:06
maxsonar-mb1240-pulse-width
/* Arduino example code for MaxBotix MB1240 XL-MaxSonar-EZ4 ultrasonic distance sensor: pulse width output. More info: www.makerguides.com */
#define sensorPin 2
long distance = 0;
long duration = 0;
@rburnett3
rburnett3 / MB7389 analog voltage
Created October 15, 2019 15:14
MB7389 analog voltage
print_data();
delay(1000);
}/* Arduino example code for MaxBotix MB7389 HRXL-MaxSonar-WR weather resistant ultrasonic distance sensor: analog voltage output. More info: www.makerguides.com */
#define sensorPin A0
int distance = 0;
void setup() {
Serial.begin(9600);
@rburnett3
rburnett3 / MB7389 pulse width
Created October 15, 2019 15:37
MB7389 pulse width
/* Arduino example code for MaxBotix MB7389 HRXL-MaxSonar-WR weather resistant ultrasonic distance sensor: pulse width output. More info: www.makerguides.com */
#define sensorPin 2
long distance = 0;
long duration = 0;
void setup() {
pinMode(sensorPin, INPUT);
Serial.begin(9600);
@rburnett3
rburnett3 / MB7389 trigger push button
Created October 15, 2019 15:44
MB7389 trigger push button
/* Arduino example code for MaxBotix MB7389 HRXL-MaxSonar-WR weather resistant ultrasonic distance sensor with push button. More info: www.makerguides.com */
#define readPin 2
#define triggerPin 3
#define buttonPin 4
long distance = 0;
long duration = 0;
int buttonState = HIGH;
int previous = HIGH;
long time = 0;
long debounce = 200;