Skip to content

Instantly share code, notes, and snippets.

/*
* Some work created by Dejan Nedelkovski,
* www.HowToMechatronics.com
*
*/
#include <Adafruit_NeoPixel.h>
// defines pins numbers
const int trigPin = 13;
const int echoPin = 12;
/*
* Some work created by Dejan Nedelkovski,
* www.HowToMechatronics.com
*
*/
#include <Adafruit_NeoPixel.h>
// defines pins numbers
const int trigPin = 13;
const int echoPin = 12;
/*
* Ultrasonic Sensor HC-SR04 and Arduino Tutorial
*
* Created by Dejan Nedelkovski,
* www.HowToMechatronics.com
*
*/
// defines pins numbers
const int trigPin = 13;
/*
Stepper Motor Control - one revolution
This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 11 of the Arduino.
The motor should revolve one revolution in one direction, then
one revolution in the other direction.
const int switchPin = 2; // switch input
const int motor1Pin = 3; // H-bridge leg 1 (pin 2, 1A)
const int motor2Pin = 4; // H-bridge leg 2 (pin 7, 2A)
const int enablePin = 9; // H-bridge enable pin
void setup() {
pinMode(switchPin, INPUT);
pinMode(motor1Pin, OUTPUT);
pinMode(motor2Pin, OUTPUT);
pinMode(enablePin, HIGH);
#include <Servo.h>
Servo myServo;
void setup() {
Serial.begin(9600);
myServo.attach(3);
}
/*
This P5 sketch is a template for getting started with Serial Communication.
The SerialEvent callback is where incoming data is received
By Arielle Hein, adapted from ITP Phys Comp Serial Labs
Edited March 13 2018
*/
/*
This P5 sketch is a template for getting started with Serial Communication.
The SerialEvent callback is where incoming data is received
By Arielle Hein, adapted from ITP Phys Comp Serial Labs
Edited March 13 2018
*/
void setup() {
Serial.begin(9600);
}
void loop() {
//read our sensor values
int sensor1 = analogRead(A0);
delay(1);
int sensor2 = analogRead(A1);