Skip to content

Instantly share code, notes, and snippets.

int ledPin=9; //Variable to store pin of LED
int potentPin=A0; //Variable to store pin of potentiometer
int potentValue=0; //Variable to store last known value of potentiometer
int brightnessValue=0; //Variable to store LED brightness
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); //Setup serial console
pinMode(ledPin, OUTPUT); //Setup LED pin for output
}
@shawngrimes
shawngrimes / analogRead.ino
Last active April 8, 2016 03:11
Basic sketch to demonstrate analog input.
int ledPin=9; //Variable to store pin of LED
int potentPin=A0; //Variable to store pin of potentiometer
int potentValue=0; //Variable to store last known value of potentiometer
int brightnessValue=0; //Variable to store LED brightness
void setup() {
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT); //Setup LED pin for output
}
@shawngrimes
shawngrimes / button.ino
Created April 8, 2016 02:29
Basic sketch demonstrating a digitalInput with a button
int ledPin=13; //Variable to store pin of LED
int buttonPin=3; //Variable to store pin of button
int buttonValue=0; //Variable to store last known value of button state
void setup() {
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT); //Setup LED pin for output
pinMode(buttonPin, INPUT); //Setup button pin for input
}
@shawngrimes
shawngrimes / analog_fade.ino
Last active April 9, 2016 15:11
Basic Arduino sketch demonstrating analog output with a fade stepping LED.
int ledPin=9; //Store LED pin number in this variable
void setup() {
//No need for setup this time
pinMode(ledPin,OUTPUT); //Setup pin 9 for OUTPUT
}
void loop() {
analogWrite(ledPin,0); //Turn the LED on pin 9 off
delay(500); //Wait 500 milliseconds
@shawngrimes
shawngrimes / blink.ino
Created April 8, 2016 02:14
Simple Arduino Blink example demonstrating the use of a variable to store the pin number for the LED

Keybase proof

I hereby claim:

  • I am shawngrimes on github.
  • I am shawngrimes (https://keybase.io/shawngrimes) on keybase.
  • I have a public key whose fingerprint is 8C8B F893 1135 A62F 33BC B48F 7A42 4C82 0E4C 6058

To claim this, I am signing this object:

if( in.isMonitoring() ){
ellipse(50,400,55,55);
}
@shawngrimes
shawngrimes / minim_input_test
Last active August 29, 2015 14:13
Testing using audio inputs and mapping that to a color.
import ddf.minim.*;
import ddf.minim.analysis.*;
float myOpacity;
float getVolume;
int mappedVolume;
Minim minim;
AudioInput in;
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
-- Your code here
local myMole=display.newImageRect("images/mole_1.png",178,200)
@shawngrimes
shawngrimes / main.lua
Created October 20, 2012 20:31
Corona SDK: Adding Sound Effects
--load your sound effect near the beginning of your file
local mySoundEffect = audio.loadSound("mySound.mp3")
--To play the sound effect, call this whenever you want to play it
audio.play(mySoundEffect)