Skip to content

Instantly share code, notes, and snippets.

//Download Adafruit_NeoPixel.h here: https://github.com/adafruit/Adafruit_NeoPixel
#include <Adafruit_NeoPixel.h>
// Which pin on the Arduino is connected to the NeoPixels?
#define PIN 6
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 1
//Download Adafruit_NeoPixel.h here: https://github.com/adafruit/Adafruit_NeoPixel
#include <Adafruit_NeoPixel.h>
// Which pin on the Arduino is connected to the NeoPixels?
#define PIN 6
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 1
/*
SEEED Studio Stepper Motor Control - one revolution
Adapts the Stepper example for use with the SEEED STUDIO motor shield.
This program drives a unipolar or bipolar stepper motor
by using the included Stepper library of the Arduino.
The motor is attached to the Seeed Studio motor shield and an Arduino.
The digital pins 8,11,12,13 drive the L298N and are used when creating the stepper object
Digital pins 9 and 10 must be high to enable the chip.
#include <Servo.h> // Use Servo library, included with IDE
Servo myServo; // Create Servo object to control the servo
void setup() {
myServo.attach(9); // Servo is connected to digital pin 9
}
void loop() {
myServo.write(0); // Rotate servo counter clockwise
delay(2000); // Wait 2 seconds
@houhr
houhr / home.html
Last active February 15, 2017 17:54
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Clock</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
ul {
list-style: none;
margin: 0;
@houhr
houhr / clock.ino
Last active November 5, 2015 01:35
#include <Parse.h>
#include <Wire.h>
#include "RTClib.h"
#include <Adafruit_NeoPixel.h>
#include <Bridge.h>
#include <Console.h>
#include <FileIO.h>
#include <HttpClient.h>
#include <Mailbox.h>
#include <Process.h>
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"
// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);
// Connect a stepper motor with 200 steps per revolution (1.8 degree)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link href='http://fonts.googleapis.com/css?family=Flamenco:300,400' rel='stylesheet' type='text/css'>
<style>
body {
font-family: 'Flamenco', cursive;
font-size: 80px;
var servi = require('servi');
var app = new servi(false); // servi instance
function sendData(request) {
// print out the fact that a client HTTP request came in to the server:
console.log("Got a client request, sending them the data.");
// respond to the client request with the latest serial string:
request.respond(latestData);
}
var serialport = require('serialport'),
SerialPort = serialport.SerialPort, // make a local instance
portName = "/dev/cu.usbmodem1451", // replace the string with your own
latestData = 0;
var myPort = new SerialPort(portName, {
baudRate: 9600,
// look for return and newline at the end of each data packet
parser: serialport.parsers.readline("\r\n")
});