Skip to content

Instantly share code, notes, and snippets.

@uknj
uknj / UltrasoundAlgorithm
Last active August 29, 2015 14:21
An ultrasound algorithm for the HC-SR04 ultrasonic sensor and the conversion to pwm in order to allow the HC-SR04 to be compatible with the ArduPilot.
#include <Ultrasonic.h> // This library is licensed under Creative Commons Share alike and Attribution by J.Rodrigo. See: https://github.com/JRodrigoTech/Ultrasonic-HC-SR04
Ultrasonic ultraleft(11,3, 25000); // (Trig PIN, Echo PIN, Time Out in milliseconds- A lower value will limit the maximum distance reading.)
Ultrasonic ultraright(6,5, 25000); // (Trig PIN, Echo PIN, Time Out in milliseconds- A lower value will limit the maximum distance reading.)
int pwmleft;
int pwmright;
void setup(){
pinMode(2, OUTPUT); // GND pin
@uknj
uknj / UltrasoundAlgorithm
Created February 10, 2015 15:29
A basic ultrasound algorithm for Arduino. To work with the HC-SR04 ultrasonic sensor and a servo motor.
#include <Servo.h>
#define trig 6
#define echo 5
#define motor 3
int distance;
Servo servoMain; // Define our Servo
int ultrasound(){
int i, temp, distance = 0;
for(i=0; i<20; ++i) {

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
/**
* Fetch data from the web and save it into a Google Sheet document
*
* Requirements:
1. NodeJS
2. npm install request
3. npm install cheerio
4. npm install edit-google-spreadsheet
* Author: Ido Green | plus.google.com/+Greenido