Skip to content

Instantly share code, notes, and snippets.

@arielchuri
arielchuri / arduinoprint.ino
Created December 10, 2020 00:55
arduinoprint
// arduino print
@arielchuri
arielchuri / capSense.ino
Created November 12, 2013 19:46
Night light with touch sensor
// Block Diagram
// +---------------------+
// | State 0: |
// | Check light sensor |
// | If it is dark: <---+
// | - Turn on light | |
// | - Change State to 1 | |
// | - Remember the time | |
// +---------+-----------+ |
// | |
@arielchuri
arielchuri / nightlightstarter.ino
Last active December 27, 2015 12:19
States 0 and 1 of a simple nightlight.
// Block Diagram
// +---------------------+
// | State 0: |
// | Check light sensor |
// | If it is dark: <---+
// | - Turn on light | |
// | - Change State to 1 | |
// | - Remember the time | |
// +---------+-----------+ |
// | |
@arielchuri
arielchuri / Fade.ino
Created September 6, 2013 20:04
Emerging Objects Class Code
int led = 13;
int led2 = 11;
int blinks;
int fade;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
Serial.begin(9600);
//Blinking and Fading
int led = 13;
int led2 = 11;
// This time the fade variable is a byte instead of an int.
byte fade;
// A big variable to keep track of the timer.
long timer;
//Blink code:
// int is type of variable. variables are where we store information.
// here we store the name of our LED pin.
int led = 13;
// another variable as an example.
int blinks;
// the setup routine runs once in the beginning.
@arielchuri
arielchuri / lightsensor.ino
Created September 6, 2013 20:09
Light Sensor code for the Emerging Objects class.
//Light Sensor Code
int led = 13;
int led2 = 11;
byte fade;
long timer;
long previousTimer;
int ledState = LOW;
int led = 13;
int led2 = 11;
int blinks;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
Serial.begin(9600);
@arielchuri
arielchuri / EmergingObjects_3_2.ino
Last active December 22, 2015 11:38
Using the CapSense data.
#include <CapacitiveSensor.h>
CapacitiveSensor cs_4_2 = CapacitiveSensor(4,2);
int led = 13;
int led2 = 11;
byte fade;
long timer;
long previousTimer;
int ledState = LOW;
int sensorPin = A0;
int sensorValue = 0;
// Setup the touch sensor.
#include <CapacitiveSensor.h>
CapacitiveSensor cs_4_2 = CapacitiveSensor(4,2);
// Setup the light sensor
int sensorPin = A0;
int sensorValue = 0;
boolean dark = false;
// Set up the LEDs