Skip to content

Instantly share code, notes, and snippets.

View akshaybaweja's full-sized avatar
🏠
Working from home

Akshay Baweja akshaybaweja

🏠
Working from home
View GitHub Profile
#include <Servo.h>
int servoPin = 9;
Servo servo;
int angle = 0; // servo position in degrees
void setup()
{
#define PIN1 8
#define PIN2 7
void setup() {
pinMode(PIN1, OUTPUT);
pinMode(PIN2,OUTPUT);
}
void loop() {
//mode 1: HL
#define LED_PIN 3
float ledValue;
void setup() {
ledValue = 0;
pinMode(LED_PIN, OUTPUT);
}
void loop() {
#define LED_PIN 3
#define SENSOR A0
boolean flag;
void setup() {
flag = false;
pinMode(LED_PIN, OUTPUT);
#define LED_PIN 3
#define SENSOR_PIN A0
const int threshold = 600;
float currentValue;
float targetValue;
float easingAmount;
int sensorValue;
// CLAP SWITCH
#define LED 3
#define CLAP_SENSE A0
bool ledState = false;
void setup() {
pinMode(LED, OUTPUT);
}
//POTENTIOMETER CONTROLLED BLINKING
#define LED 3
#define POT A0
void setup() {
pinMode(LED, OUTPUT);
}
void loop() {
// Touch Sensor
#include <CapacitiveSensor.h>
#define LED 3
CapacitiveSensor cs_4_2 = CapacitiveSensor(4, 2);
void setup()
{
pinMode(LED, OUTPUT);
}
#define LED 3
#define LDR A0
bool ledState = false;
void setup() {
pinMode(LED, OUTPUT);
}
void loop() {
/*
If button is pressed for 3 seconds, one LED should light up.
If button is pressed for 6 seconds, another LED should light up.
If a button is pressed and held for 6 seconds and a second button is pressed, make the LED do some special behavior.
Explore combining behaviors.
How many different LED behaviors can you get out of just two switches and measuring how long they're pressed?
*/
#define LED1 5
#define LED2 6