Skip to content

Instantly share code, notes, and snippets.

Avatar

Suad Anwar suadanwar

View GitHub Profile
@suadanwar
suadanwar / RBTLineFollowing.ino
Last active Feb 14, 2019
This is a sample code for Line Following Robot using Arduino.
View RBTLineFollowing.ino
#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 Feb 16, 2019
This is a sample code for Obstacle Avoiding Robot using Arduino.
View Obstacle_Avoiding_Robot.ino
#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 Feb 28, 2019
This is a sample code for Bluetooth Mobile Robot with Maker Drive.
View BTMobile_MakerDrive.ino
#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 Mar 20, 2019
This sample code is for Obstacles Avoiding Robot with Maker Drive.
View ObstaclesAvoidingRobot_MakerDrive.ino
#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 Apr 4, 2019
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/
View OLEDdisplay.ino
#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)
View RFID_RC522.ino
/*
--------------------------------------------------------------------------------------------------------------------
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 Jul 25, 2019
This sample code is for Simple GUI to Control LED on Arduino with Processing's tutorial. This is Arduino sample code.
View LED_GUI.ino
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 Jul 26, 2019
This sample code is for Simple GUI to Control LED on Arduino with Processing's tutorial. This is Processing sample code.
View LED_GUI.pde
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 Aug 1, 2019
This sample code is for Control Servo and Display Sensor's Reading with the GUI on Arduino's Tutorial. [Arduino]
View ServoUltrasonic.ino
#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 Aug 1, 2019
This sample code is for Control Servo and Display Sensor's Reading with the GUI on Arduino's Tutorial. [Processing]
View ServoUltrasonic.pde
import processing.serial.*;
import controlP5.*;
Serial myPort;
ControlP5 cp5;
ControlGroup messageBox;
String data = "0";
void setup() {
size(500,430);