Skip to content

Instantly share code, notes, and snippets.

View suadanwar's full-sized avatar

Suad Anwar suadanwar

View GitHub Profile
@suadanwar
suadanwar / RBTLineFollowing.ino
Last active February 14, 2019 16:32
This is a sample code for Line Following Robot using Arduino.
#define BUTTON 2
#define PIEZO 8
#define L293N_ENA 5
#define L293N_ENB 6
#define L293N_IN1 7
#define L293N_IN2 9
#define L293N_IN3 10
#define L293N_IN4 11
@suadanwar
suadanwar / Obstacle_Avoiding_Robot.ino
Last active February 16, 2019 15:56
This is a sample code for Obstacle Avoiding Robot using Arduino.
#define TRIGPIN 3
#define ECHOPIN 4
#define L298N_ENA 5
#define L298N_ENB 6
#define L298N_IN1 7
#define L298N_IN2 9
#define L298N_IN3 10
#define L298N_IN4 11
@suadanwar
suadanwar / BTMobile_MakerDrive.ino
Last active February 28, 2019 10:46
This is a sample code for Bluetooth Mobile Robot with Maker Drive.
#define BT_TX 4
#define BT_RX 2
#include "SoftwareSerial.h"
SoftwareSerial BTSerial(BT_TX, BT_RX); // Maker UNO RX, TX
#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.
@suadanwar
suadanwar / ObstaclesAvoidingRobot_MakerDrive.ino
Created March 20, 2019 08:24
This sample code is for Obstacles Avoiding Robot with 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.
long duration;
long distance;
#define BUTTON 2
#define PIEZO 8
#define TRIGPIN 5
@suadanwar
suadanwar / OLEDdisplay.ino
Last active April 4, 2019 11:22
This is a sample code for "How to Display on I2C OLED Using Arduino" tutorial. The tutorial link : http://tutorial.cytron.io/2019/04/04/how-to-display-on-i2c-oled-with-arduino/
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.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)
#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
/*
--------------------------------------------------------------------------------------------------------------------
Example sketch/program showing how to read data from a PICC to serial.
--------------------------------------------------------------------------------------------------------------------
Typical pin layout used:
-----------------------------------------------------------------------------------------
MFRC522 Arduino Arduino Arduino Arduino Arduino
Reader/PCD Uno/101 Mega Nano v3 Leonardo/Micro Pro Micro
Signal Pin Pin Pin Pin Pin Pin
-----------------------------------------------------------------------------------------
@suadanwar
suadanwar / LED_GUI.ino
Last active July 25, 2019 16:50
This sample code is for Simple GUI to Control LED on Arduino with Processing's tutorial. This is Arduino sample code.
boolean state = false;
void setup() {
pinMode(3, OUTPUT); //Set pin as an output
Serial.begin(9600); //Start serial communication @9600 bps
}
void loop() {
@suadanwar
suadanwar / LED_GUI.pde
Last active July 26, 2019 02:01
This sample code is for Simple GUI to Control LED on Arduino with Processing's tutorial. This is Processing sample code.
import controlP5.*; //import ControlP5 library
import processing.serial.*;
Serial port;
ControlP5 cp5; //create ControlP5 object
void setup(){ //Same as setup in arduino
size(300, 300); //Window size, (width, height)
@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);