Giter VIP home page Giter VIP logo

asumobicarg27's Introduction

ASUMobiCarG27

#include <SoftwareSerial.h> SoftwareSerial bluetooth (10,11);//Rx,Tx (ARDUINO) char data ; #define trigPin 9 #define echoPin 8 int AF=3;//in1 int AB=4;//in2 int BF=5;//in3 =>of the motor driver int BB=6;//in4 void setup() { // put your setup code here, to run once: bluetooth.begin(9600); pinMode(AF,OUTPUT); pinMode(AB,OUTPUT); pinMode(BF,OUTPUT); pinMode(BB,OUTPUT); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT);

}

void loop() { digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(5); digitalWrite(trigPin, LOW); // Take reading on echo pin float duration = pulseIn(echoPin, HIGH);

// convert the time into a distance float cm = duration / 29 / 2;

// put your main code here, to run repeatedly: if( case == 'F' && cm > 5){ if(bluetooth.available()) {
data=bluetooth.read(); switch(data){ case'B'://go back digitalWrite(AF,HIGH); digitalWrite(BF,HIGH); digitalWrite(AB,LOW); digitalWrite(BB,LOW); break; case'F'://go forward digitalWrite(AF,LOW); digitalWrite(BF,LOW); digitalWrite(AB,HIGH); digitalWrite(BB,HIGH); break; case'R':// go right digitalWrite(AF,HIGH); digitalWrite(BF,LOW); digitalWrite(AB,LOW); digitalWrite(BB,HIGH); break; case'L':// go left digitalWrite(AF,LOW); digitalWrite(BF,HIGH); digitalWrite(AB,HIGH); digitalWrite(BB,LOW); break; default: digitalWrite(AF,LOW); digitalWrite(BF,LOW); digitalWrite(AB,LOW); digitalWrite(BB,LOW);

}

}

else if (case == 'F' && cm <= 5 ) { digitalWrite(AF,HIGH); digitalWrite(BF,LOW); digitalWrite(AB,LOW); digitalWrite(BB,HIGH); digitalWrite(13,HIGH); } } }

asumobicarg27's People

Contributors

a7md7mdy avatar ahmadfedaaalmokakahal avatar a7medmostafa avatar ahmedaliahmedmostafa avatar mostafaelkady avatar 1fahmy1 avatar moazgamal avatar islaaaam avatar

asumobicarg27's Issues

How does the line follower work ???

The Line Follower sensor is an add-on for your RedBot that gives your robot the ability to detect lines or nearby objects. The sensor works by detecting reflected light coming from its own infrared LED. By measuring the amount of reflected infrared light, it can detect transitions from light to dark (lines) or even objects directly in front of it.

The sensor has a 3-pin header which connects directly to the RedBot Mainboard via female to female jumper wires. Use the included RedBot library to detect lines or objects. A mounting hole lets you easily connect one or more of these to the front or back of your robot chassis.

motor drive

//Motor A
const int motorPin1 = 9; // Pin 14 of L293
const int motorPin2 = 10; // Pin 10 of L293
//Motor B
const int motorPin3 = 6; // Pin 7 of L293
const int motorPin4 = 5; // Pin 2 of L293

//This will run only one time.
void setup(){

//Set pins as outputs
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
pinMode(motorPin3, OUTPUT);
pinMode(motorPin4, OUTPUT);

//Motor Control - Motor A: motorPin1,motorpin2 & Motor B: motorpin3,motorpin4

//This code  will turn Motor A clockwise for 2 sec.
analogWrite(motorPin1, 180);
analogWrite(motorPin2, 0);
analogWrite(motorPin3, 180);
analogWrite(motorPin4, 0);
delay(5000); 
//This code will turn Motor A counter-clockwise for 2 sec.
analogWrite(motorPin1, 0);
analogWrite(motorPin2, 180);
analogWrite(motorPin3, 0);
analogWrite(motorPin4, 180);
delay(5000);

//This code will turn Motor B clockwise for 2 sec.
analogWrite(motorPin1, 0);
analogWrite(motorPin2, 180);
analogWrite(motorPin3, 180);
analogWrite(motorPin4, 0);
delay(1000); 
//This code will turn Motor B counter-clockwise for 2 sec.
analogWrite(motorPin1, 180);
analogWrite(motorPin2, 0);
analogWrite(motorPin3, 0);
analogWrite(motorPin4, 180);
delay(1000);    

//And this code will stop motors
analogWrite(motorPin1, 0);
analogWrite(motorPin2, 0);
analogWrite(motorPin3, 0);
analogWrite(motorPin4, 0);

}

void loop(){

}

12V Battery Level Indicator Circuit

his battery level indicator offers (5) LEDs that light up progressively as the voltage increases:

Red: Power Connected (0%)
Yellow: Greater than 10.5V (25%)
Green 1: Greater than 11.5V (50%)
Green 2: Greater than 12.5V (75%)
Green 3: Greater than 13.5V (100%)

Operation of the battery level indicator

D1 is the voltage reference zener. Tied to this is a string of divider resistors (R2-6) that set the various fixed voltage levels. R7 & 8 form a voltage divider to that reduces the battery voltage by a factor of 3. U1 is an LM339 quad comparator that compares the various voltages from the two dividers. The comparator sections have open collector outputs that simply function as switches to operate the LEDs. D7 protects against reverse battery connection.

The LEDs are biased to operate at about 4mA which is quite bright if modern LEDs are used. This current can be adjusted simply by varying the series resistors (R9 through R13). The overall current drain as shown is about 25mA which tends to be wasteful for continuous operation. For energy conservation, connect to battery via a pushbutton (Push to Test).

motor drive l298

motor driver is based on the very popular L298 Dual H-Bridge Motor Driver IC. This module will allow you to easily and independently control two motors of up to 2A each in both directions.

It is ideal for robotic applications and well suited for connection to a microcontroller requiring just a couple of control lines per motor.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.