Skip to content

Instantly share code, notes, and snippets.

// the input pin where the // pushbutton is connected
void button_light()
{
val = digitalRead(BUTTON); // read input value and store it
// check if there was a transition
if ((val == HIGH) && (old_val == LOW)) // when ever there is a change in state from button pressed
{
state = 1 - state;
@c010
c010 / Tut2.ino
Created January 27, 2016 03:49
Tut 2
const int LED = 9; // the pin for the LED
int i = 0; // We'll use this to count up and down
int led = 13;
const int BUTTON = 7; // input pin of the pushbutton
int val = 0; // stores the state of the input pin
int old_val = 0; // stores the previous value of "val"
int state = 0; // 0 = LED off while 1 = LED on
int brightness = 128; // Stores the brightness value
unsigned long startTime = 0; // when did we begin pressing
// Libraries
import processing.serial.*;
import cc.arduino.*;
//Calling Arduino Ports
//Numbers represent pins
Arduino arduino;