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
// tutorial | |
// https://www.makerguides.com/a4988-stepper-motor-driver-arduino-tutorial/ | |
#include <AccelStepper.h> | |
// Define stepper motor connections and motor interface type. Motor interface type must be set to 1 when using a driver: | |
#define dirPin 2 | |
#define stepPin 3 | |
#define motorInterfaceType 1 |
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
// Measuring Stick | |
// Light up neopixel strip proportional to distance sensor reading | |
#include <Adafruit_NeoPixel.h> | |
#define LED_PIN 6 | |
#define LED_COUNT 10 | |
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800); | |
int trigPin = 12; | |
int echoPin = 13; |
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
int greenLED = 11; | |
int orangeLED = 13; | |
unsigned long greenTimer = 0; | |
unsigned long greenInterval = 1000; //this will get updated in loop() | |
bool greenLEDstate = LOW; | |
unsigned long orangeTimer = 0; | |
unsigned long orangeInterval = 1000; //this will get updated in loop() | |
bool orangeLEDstate = LOW; |
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
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson | |
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library | |
#include <Adafruit_NeoPixel.h> | |
#ifdef __AVR__ | |
#include <avr/power.h> | |
#endif | |
// Which pin on the Arduino is connected to the NeoPixels? | |
// On a Trinket or Gemma we suggest changing this to 1 |
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
/* | |
* Use a LDR as a light sensor to turn on things (LEDs, motors, etc) when it gets dark. | |
* After a given time period, have them turn off (while it's still dark). | |
* Daylight resets the system as it waits for nightfall, to begin again. | |
*/ | |
unsigned long currentTime; | |
unsigned long loopTime; | |
unsigned long blinkTimer = (unsigned long)250; | |
// Need to cast each operand, otherwise the math is not correct: |
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
// Originally copied from Becky Stern https://www.tinkercad.com/things/hMoLHIEK0Ny-neopixel-strip | |
// Modified to add reverse direction and adapted to ATTiny85 | |
// Added photoresistor to activate at night time | |
// For randomized sparkle effect, refer to "Sipping Power With NeoPixels" guide. | |
// https://learn.adafruit.com/sipping-power-with-neopixels/demo-code | |
// This circuit can be viewed and simulated at: | |
// https://www.tinkercad.com/things/8dXZVFS18mn-attiny85-neopixel-after-dark-randomized-colors-sparkle-effect | |
#include <Adafruit_NeoPixel.h> |
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
//answering a question from StackExchange: | |
//https://arduino.stackexchange.com/questions/53976/too-few-arguments-for-multiple-if-statement-conditions/53979#53979 | |
// Blue LED blinks | |
// Red LED should go on if Blue LED is ON and switch/button is in correct posistion | |
// Concurrent LED blinking code from here: https://learn.adafruit.com/multi-tasking-the-arduino-part-1/using-millis-for-timing | |
int redLEDPin = 7; | |
int blueLEDPin = 3; | |
int redLEDtiming = 250; | |
int blueLEDtiming = 2000; |
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
int trigPin = 12; | |
int echoPin = 13; | |
void setup() | |
{ | |
Serial.begin (9600); | |
pinMode(trigPin, OUTPUT); | |
pinMode(echoPin, INPUT); | |
} |
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
/* | |
Blink NeoPixels randomly: vary color and on/off timing | |
by @GreenMoonArt | |
*/ | |
#include <Adafruit_NeoPixel.h> | |
#define PIN 6 | |
#define numPIXELS 8 | |
#define numCOLORS 7 |
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
/* | |
* Code to similuate dripping icicles using Arduino and multiple NeoPixel strips | |
* be sure to weatherize if you are putting this outdoors | |
*/ | |
#include <Adafruit_NeoPixel.h> | |
#ifdef __AVR__ | |
#include <avr/power.h> | |
#endif |
NewerOlder