Skip to content

Instantly share code, notes, and snippets.

View suadanwar's full-sized avatar

Suad Anwar suadanwar

View GitHub Profile
@suadanwar
suadanwar / Magnetic_Sensor
Created August 8, 2019 07:07
This sample code is for Magnetic Contact Switch Sensor's Tutorial
#define SENSOR 2
#define PIEZO 8
#define NOTE_G4 392
#define NOTE_C5 523
#define NOTE_G5 784
#define NOTE_C6 1047
int Sound[] = {NOTE_G5, NOTE_C6};
int SoundNoteDurations[] = {12, 8};
@suadanwar
suadanwar / PipiMerah_Melody.ino
Created August 9, 2019 07:23
This is s sample code for Si Comel Pipi Merah Melody for Maker UNO.
/*
Melody
Plays a melody
circuit:
- 8 ohm speaker on digital pin 8
created 21 Jan 2010
modified 30 Aug 2011
@suadanwar
suadanwar / IRremote.ino
Created August 22, 2019 11:00
This sample code is for Controlling LED on Maker UNO (Arduino) using IR Remote's Tutorial.
// Include IR Remote Library by Ken Shirriff
#include <IRremote.h>
// Define sensor pin
const int RECV_PIN = 4;
// Define LED pin
#define RED 8
#define GREEN 9
#define YELLOW 10
@suadanwar
suadanwar / lovebox.ino
Created August 29, 2019 06:50
This sample code is for Chocolate Box with Touch Sensor and Arduino's tutorial.
#include <Servo.h>
Servo myservo1;
Servo myservo2;
int touchSensorPin = 2;
int touchSensorState = 0;
void setup() {
myservo1.attach(9);
myservo2.attach(10);
@suadanwar
suadanwar / DHT22Oled.ino
Created September 12, 2019 16:26
This sample code is to Display Temperature and Humidity on OLED using DHT22 and Arduino tutorial.
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "DHT.h"
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
@suadanwar
suadanwar / raindetector.ino
Created October 2, 2019 03:38
This sample code is for rain detector tutorial.
#include <Servo.h> // Include the library for the servo
#define RAIN_SENSOR A0
#define SERVO1_PIN 10
#define SERVO2_PIN 11
Servo myservo1; // Create servo object to control a servo
Servo myservo2;
int rainAdc = 0;
@suadanwar
suadanwar / plantNotification.ino
Created October 3, 2019 05:46
This sample code is using ESP 32 and moisture sensor. This sample code is for Watering Plant Notification using ESP32 and Blynk Tutorial.
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
// Your WiFi credentials.
@suadanwar
suadanwar / LineFollowing_MakerDrive.ino
Last active October 9, 2019 07:50
This sample code is for Line Following Robot using Arduino an Maker Drive tutorial. Please refer to this tutorial for more info : https://tutorial.cytron.io/2019/03/28/line-following-robot-using-arduino-maker-drive/
#include "CytronMotorDriver.h"
// Configure the motor driver.
CytronMD motor1(PWM_PWM, 3, 9); // PWM 1A = Pin 3, PWM 1B = Pin 9.
CytronMD motor2(PWM_PWM, 10, 11); // PWM 2A = Pin 10, PWM 2B = Pin 11.
#define BUTTON 2
#define PIEZO 8
#define IR_LEFT A0
#define IR_RIGHT A1
@suadanwar
suadanwar / Height.ino
Last active October 11, 2019 00:07
This sample code is for height measurement using ultrasonic sensor and dot matrix on Maker UNO's tutorial.
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLK_PIN 13
#define DATA_PIN 11
#define CS_PIN 10
#define scrollSpeed 70 // scroll speed
@suadanwar
suadanwar / SafeBox.ino
Created October 17, 2019 10:35
This sample code is for Safe Box's Tutorial.
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 2);
#include <Keypad.h>
#include <Servo.h>
Servo myservo;
#define Password_Lenght 7 // Give enough room for six chars + NULL char