Skip to content

Instantly share code, notes, and snippets.

View VincentK16's full-sized avatar
:octocat:
Connect with me

Vincent Kok VincentK16

:octocat:
Connect with me
View GitHub Profile
@VincentK16
VincentK16 / Active-LOW button
Created July 11, 2013 08:50
This is the code for active-LOW button which we turn on an LED when the switch is pressed
const int buttonPin = 8; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
/*
Copyright (C) 2011 J. Coliz <[email protected]>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
*/
/**
* Example RF Radio Ping Pair
@VincentK16
VincentK16 / HC-SR04 Ultrasonic Sensor
Created July 1, 2013 11:34
This is a simple coding that display the distance of the obstacle to the sensor. When the sensor is approaching the obstacle, the buzzer will sound at a higher rate.
#include <NewPing.h>
#define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
void setup() {
Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.
@VincentK16
VincentK16 / DS1307 RTC
Last active December 31, 2017 11:21
DS 1307 Simple Sketch
#include <Wire.h>
#include "RTClib.h"
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
RTC_DS1307 RTC;
void setup () {
Serial.begin(9600);
Wire.begin();
RTC.begin();
@VincentK16
VincentK16 / Wireless Controlled Relay
Created June 27, 2013 14:11
Wireless Controlled Relay
int pin = 8;
void setup(){
Serial.begin(9600);
pinMode(pin,OUTPUT);
digitalWrite(pin,LOW);
}
void loop()
{
@VincentK16
VincentK16 / gist:5450215
Created April 24, 2013 07:13
My First Stackable Circuit
int led1 = 5;
int led2 = 6;
int led3 = 7;
int led4 = 8;
int led5= 9;
int led6= 10;
int led7 = 11;
int BUTTON = 12;
void setup() {