Skip to content

Instantly share code, notes, and snippets.

View boxalljohn's full-sized avatar

John Boxall boxalljohn

View GitHub Profile
@boxalljohn
boxalljohn / blink.ino
Created June 21, 2013 08:10
Arduino blink example
@boxalljohn
boxalljohn / gist:5996738
Created July 15, 2013 00:26
Example 3.1
// example 3.1
void setup()
{
pinMode (2, OUTPUT); // set pin 2 as an output pin
}
void loop()
{
for (int i = 1; i<=20; i++) // loop 20 times
void blinkthree() // the name of my function is "blinkthree"
{
for (int i = 0; i <3; i++) // loop three times
{
digitalWrite(8, HIGH); // turn on LED connected to digital pin 8
delay (1000);
digitalWrite(8, LOW); // turn off LED connected to digital pin 8
delay (1000);
}
}
float circlearea (float radius)
{
float result = 0;
result = 3.141592654 * radius * radius;
return result;
}
#include <Servo.h>
Servo myservo;
myservo.attach(9); // attaches the servo on pin 9 to the servo object
myservo.write(pos);