Skip to content

Instantly share code, notes, and snippets.

View suadanwar's full-sized avatar

Suad Anwar suadanwar

View GitHub Profile
@suadanwar
suadanwar / ServoUltrasonic.ino
Created August 1, 2019 06:52
This sample code is for Control Servo and Display Sensor's Reading with the GUI on Arduino's Tutorial. [Arduino]
#include <Servo.h> // Include the Servo library
int servoPin = 3;
const int trigPin = 9;
const int echoPin = 10;
Servo myServo; // Create a servo object
int val = 0;
long duration;
int distance;
void setup() {
@suadanwar
suadanwar / ServoUltrasonic.pde
Created August 1, 2019 06:54
This sample code is for Control Servo and Display Sensor's Reading with the GUI on Arduino's Tutorial. [Processing]
import processing.serial.*;
import controlP5.*;
Serial myPort;
ControlP5 cp5;
ControlGroup messageBox;
String data = "0";
void setup() {
size(500,430);
@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 / calculator.ino
Created September 19, 2019 09:20
This sample code is for Calculator Using 4x4 Keypad and I2C LCD on Arduino.
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char keys [ROWS] [COLS] = {
{'1', '2', '3', '+'},
@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.