This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a comment - anything on a line after "//" is ignored | |
// by the computer. | |
/* This is also a comment - this one can be multi-line, but it | |
must start and end with these characters */ | |
// You must "declare" variables before you use them, | |
// so that the program knows about them. | |
int ledPin1 = 7; | |
int ledPin2 = 8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int ledPin1 = 3; | |
const int ledPin2 = 4; | |
const int ledPin3 = 5; | |
const int ledPin4 = 6; | |
void setup() { | |
pinMode(ledPin1, INPUT); | |
pinMode(ledPin2, INPUT); | |
pinMode(ledPin3, INPUT); | |
pinMode(ledPin4, INPUT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Servo.h> | |
#include <math.h> | |
Servo myservo; // create servo object to control a servo | |
int potVal = 0; // variable to read the value from the analog pin | |
int processedPotVal = 0; | |
int photoVal; // variable to read the value from the photoresistor | |
const int ledPin1 = 3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// YACViewController.m | |
// YetAnotherClone | |
// | |
// Created by Akmal Abdul Rahman on 12/3/14. | |
// Copyright (c) 2014 Akmal Abdul Rahman. All rights reserved. | |
// | |
#import "YACViewController.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Blink | |
Turns on an LED on for one second, then off for one second, repeatedly. | |
This example code is in the public domain. | |
*/ | |
// Pin 13 has an LED connected on most Arduino boards. | |
// give it a name: | |
int led = 13; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int LED_PIN = 12; | |
// the setup routine runs once when you press reset: | |
void setup() { | |
pinMode(LED_PIN, OUTPUT); | |
digitalWrite(LED_PIN, HIGH); | |
delay(3000); | |
digitalWrite(LED_PIN, LOW); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int LIMIT_SWITCH_PIN = 12; | |
const int LED_PIN = 13; | |
void setup() { | |
pinMode(LIMIT_SWITCH_PIN, INPUT); | |
digitalWrite(LIMIT_SWITCH_PIN,HIGH); | |
pinMode(LED_PIN, OUTPUT); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <NewPing.h> | |
const int ULTRASONIC_TRIGGER = 6; | |
const int ULTRASONIC_ECHO = 7; | |
#define MAX_DISTANCE 100 | |
NewPing sonar(ULTRASONIC_TRIGGER, ULTRASONIC_ECHO, MAX_DISTANCE); | |
void setup() { | |
pinMode(ULTRASONIC_TRIGGER, OUTPUT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <NewPing.h> | |
const int ULTRASONIC_TRIGGER = 6; | |
const int ULTRASONIC_ECHO = 7; | |
const int LED_PIN = 11; | |
#define MAX_DISTANCE 100 | |
NewPing sonar(ULTRASONIC_TRIGGER, ULTRASONIC_ECHO, MAX_DISTANCE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <NewPing.h> | |
#include <NewTone.h> | |
const int ULTRASONIC_TRIGGER = 6; | |
const int ULTRASONIC_ECHO = 7; | |
const int BUZZER_PIN = 9; | |
#define MAX_DISTANCE 100 | |
NewPing sonar(ULTRASONIC_TRIGGER, ULTRASONIC_ECHO, MAX_DISTANCE); |
OlderNewer