Skip to content

Instantly share code, notes, and snippets.

View buildcircuit's full-sized avatar

Sagar Sapkota buildcircuit

View GitHub Profile
@buildcircuit
buildcircuit / gist:686586bc1a995a4354b7
Last active August 29, 2015 14:22
Relay ON/OFF with Smart phone app
void setup() {
// Open serial communications:
Serial.begin(9600);
pinMode(2, OUTPUT);
// send an intro:
Serial.println("Enter a value");
Serial.println();
}
@buildcircuit
buildcircuit / Active buzzer test
Created August 17, 2015 04:57
Active buzzer test
int buzzer=8;// Set the control the buzzer digital IO pin
void setup()
{
pinMode(buzzer,OUTPUT);// Setting the digital IO pin mode , OUTPUT is Wen out
}
void loop()
{
unsigned char i,j;// Define the variable
while(1)
{
int sensor1 = A0; //connected to analog 0
void setup()
{
Serial.begin(9600);
}
void loop() {int sensor1pin = analogRead(sensor1);
Serial.print("sensor1:");
Serial.println(sensor1pin);
delay(2000);
@buildcircuit
buildcircuit / adxl345.ino
Created September 2, 2015 01:26
Triple Axis Accelerometer ADXL345
//Add the SPI library so we can communicate with the ADXL345 sensor
#include <SPI.h>
//Assign the Chip Select signal to pin 10.
int CS=10;
//This is a list of some of the registers available on the ADXL345.
//To learn more about these and the rest of the registers on the ADXL345, read the datasheet!
char POWER_CTL = 0x2D; //Power Control Register
@buildcircuit
buildcircuit / adxl335
Created September 2, 2015 01:37
adxl335 accelerometer
//Analog read pins
const int xPin = 0;
const int yPin = 1;
const int zPin = 2;
//The minimum and maximum values that came from
//the accelerometer while standing still
//You very well may need to change these
int minVal =270;
int maxVal =440;
//Analog read pins
const int xPin = 0;
const int yPin = 1;
const int zPin = 2;
//The minimum and maximum values that came from
//the accelerometer while standing still
//You very well may need to change these
int minVal =270;
int maxVal =440;
@buildcircuit
buildcircuit / rgb-led.ino
Created September 3, 2015 04:30
RGB LED
/* FILE: ARD_RGB_LED_MODULE_HCARDU0021_Example.pde
DATE: 04/07/12
VERSION: 0.1
This is a simple example of how to use the HobbyComponents RGB LED module
(HCARDU0021). The module has 3 separate LED's (Red, Green & Blue) which
Can be individually driven by applying a voltage to the appropriate module pin.
This example uses the standard Arduino analogWrite (PWM) function to cycle
through the full range of colours this module is capable of producing.
Please be aware that this module does NOT include current limiting
/*arduino touch 8
VCC-----------5V
GND-----------GND
OUT1-----------2
OUT2-----------3
OUT3-----------4
OUT4-----------5
OUT5-----------6
OUT6-----------7
OUT7-----------8
@buildcircuit
buildcircuit / gist:2758364
Last active October 5, 2015 05:47
PWM control signals using Arduino and Infrared
/*
RemoteDecode sketch
Infrared remote control signals are decoded to control LED brightness
The values for keys 0 through 4 are detected and stored when the sketch starts
key 0 turns the LED off, the brightness increases in steps with keys 1 through 4
*/
#include <IRremote.h> // IR remote control library
const int irReceivePin = 2; // pin connected to the output of the IR detector
const int ledPin = 9; // LED is connected to a PWM pin
const int numberOfKeys = 5; // 5 keys are learned (0 through 4)
/*
Multicolor Lamp (works with Amarino and the MultiColorLamp Android app)
- based on the Amarino Multicolor Lamp tutorial
- receives custom events from Amarino changing color accordingly
author: Bonifaz Kaufmann - December 2009
*/
#include <MeetAndroid.h>